-4

I have a class

public class BaseClass
{

}

I have a child class

public class ChildClass : BaseClass
{

}

I want to know what classes/types inherit from BaseClass (find ChildClass for example). I know that i have to use assemble and reflection but don't know how/which function to use.

Edit: ok maybe now you'll get it

fuz
  • 88,405
  • 25
  • 200
  • 352
Bizio
  • 45
  • 7

1 Answers1

1
typeof(BaseClass).Assembly.GetTypes().Where(type => type.IsSubclassOf(typeof(A)));

You can do this by two step:

  1. Get all types from Assembly
  2. Find only classes which is subclasses of BaseClass
Fedor
  • 181
  • 5