Asuming baseType contains the System.Type object that you want to test, and matchType contains the System.Type object with the type of the current iteration (through a foreach loop or whatever):
If you want to check wheather matchType obtained from the class represented by baseType, I would use
matchType.IsSubclassOf(baseType)
And if you want to check wheather matchType implements the interface provided by baseType, I would use
matchType.GetInterface(baseType.ToString(), false) != null
Of course, I would save baseType.ToString () as a global variable, so I would not have to call it all the time. And since you will probably need this in a context where you have many types, you can also consider using System.Threading.Tasks.Parallel.ForEach-Loop to repeat all your types ...
Fredrik Rasch Jun 21 '12 at 17:17 2012-06-21 17:17
source share