c# - Creating a collection of all classes that inherit from IBlahblah -
Using reflection (I'm guessing?), Is it possible to prepare a method that is a collection of all objects Will he inherit from an interface called IBlahblah?
Public Interface iblahlahah;
Assume that you have an assembly (or list of assemblies), you You can get a collection of type which implements an interface:
var blahs = assembly.GetTypes (). Where (t => gtb (IBlahblah) .IsAssignableFrom (t));
You can not obtain a collection of "Live Objects" that implement the interface - at least without debugging / profiling API or using something similar.
Comments
Post a Comment