I have three class as following:
public class TestEntity { }
public class BaseClass<TEntity> { }
public class DerivedClass : BaseClass<TestEntity> { }
I already get the System.Type object of DerivedClass using reflection in runtime. How can I get the System.Type object of TestEntity using reflection?
Thanks.
I assume that your code is just a sample and you don’t explicitly know
DerivedClass.Note that this code can fail very easily at run time you should verify if type you handle is what you expect it to be:
Also there can be deeper inheritance tree so some loop with above condition would be required.