Is it possible to get at run time the type of a generic class that has a variable number of type parameters?
I.e., based on a number, can we get the type of a tuple with this number of elements?
Type type = Type.GetType("System.Tuple<,>");
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.
The way to write that is
The format of generic types is simple:
` is character 96. (ALT+96).
However i would avoid using strings, it is slower than using typeof, or better, an array lookup.
I would provide a nice static function that is thousand of times faster…