Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you determine whether or not a given Type (System.Type) inherits from a specific base class (in .Net)?

This is likely going to be an easy answer and I'm just missing something, but here goes...If I have a Type, (that is, an actual System.Type...not an instance) how do I tell if it inherits from another specific base type?

like image 450
Kilhoffer Avatar asked Sep 10 '25 06:09

Kilhoffer


1 Answers

Use the IsSubclassOf method of the System.Type class.

like image 119
chakrit Avatar answered Sep 12 '25 20:09

chakrit