Answer the question
In order to leave comments, you need to log in
Reflection and generic C# types?
In general, the situation is as follows:
1. There is a generic type, for example class MyGeneric<T> {public T value;}
2. There is a type variable of type Type, the value of which stores information about a certain type. The information is obtained by the typeof(SomeType) operation.
Can I create an object of a generic type and pass as a parameter exactly the type that is stored in the type variable Type?
Example:
Typetype = typeof(DateTime);
I want a generic type object like MyGeneric<DateTime>. But how to pass as a parameter what is stored in type is a mystery
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question