oop - .NET: Get all classes derived from specific class -
i have custom control , number of controls derived it. need classes in current assembly derived main class , check attributes. how accomplish this?
var type = typeof(mainclass); var listofderivedclasses = assembly.getexecutingassembly() .gettypes() .where(x => x.issubclassof(type)) .tolist(); foreach (var derived in listofderivedclasses) { var attributes = derived.getcustomattributes(typeof(theattribute), true); // etc. }
Comments
Post a Comment