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

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -