views:

41

answers:

1

I would like to know if it is possible to get all the objects running from an application/assembly/appdomain of a specific type...

I don't think reflection would help in this case as I need an object before hand. However, I want to got the other way: from a type I want all the objects created from it.

Is this possible with .Net?

+4  A: 

No, it isn't possible - at least not without using the debugger/profiler API. That may make it possible (I wouldn't like to swear) but it's not really an API you should be using unless you're really writing a debugger or profiler.

Jon Skeet
Wow, that was fast!
Stecy
If you own the object, you could of course implement a static list of weak references that you periodically sweep. But that's only possible if you own the type or can always guarantee factory-based construction.
LBushkin