If I had generic class:
public class GenericTest<T> : IGenericTest {...}
and I had an instance of Type, which I got through reflection, how could I instantiate GenericType with that Type? For example:
public IGenericTest CreateGenericTestFromType(Type tClass) { return (IGenericTest)(new GenericTest<tClass>()); }
Of course, the above method won’t compile, but it illustrates what I’m trying to do.
You need to use Type.MakeGenericType: