Click here to Skip to main content
15,868,016 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

Lets assume that we have an abstract class X<t1,t2> and w have two derived classes Y:X<int,float> and Z:X<float,string>.

Now, I wanna to get all types that implements the abstract class X. How can I define the type in the typeof() to do that?
Posted

1 solution

You need to use reflection.

The following class: System.Reflection.Assembly

Has the following method: GetTypes

This returns an array of all the types defined within that assembly. Then for each type you need to recursively check the BaseType property for abstract class X.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900