How can i get the System.Type of a (Type in a generic function)?
I need to get a string representation of the class name.
typeof(T).GetType().Name
gives me ‘runtimetype’, which i do not want.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Just do:
That will result in the actual type of
TwhateverTis for that particular instance of your generic class/method. IfThappened to beSystem.String, you would get an instance of the type representingSystem.String.