I have the following code. t is showing as invalid on the second line.
Cannot resolve symbol 't'
How can I instantiate a generic class using Type t.
Type t = currentProperty.PropertyType;
var x = new MyClass<t>();
thank you
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.
Generics are only a compile time feature, not a runtime feature. You need to create the class using reflection.