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

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -