Smalltalk supports "obj allInstances" and is one of the few that do.
It's normally considered but practice to to rely on the environment for
this, as it may be hard return "all" objects in a multthread, GC'd
environment, and having the system always ready return all instances may
incur constant overhead that you wouldn't want to impose on all programs.
You'll probably need to keep your own collection of objects of the types you
want to track and you may want to use the WeakReference class so that your
collection doesn't keep objects alive that are meant to be reclaimed,
depending on how you're tracking the objects.
m
"Peter Rilling" <pe***@nospam.rilling.net> wrote in message
news:ug**************@TK2MSFTNGP09.phx.gbl...
No. I don't think so.
"David Krmpotic" <da************@no-no.si> wrote in message
news:Rm********************@news.siol.net... Hello,
I want to find all the objects of some type that are currently in memory.
So it is somehow reverse from GetType().
I want to do this:
foreach(MyObject o in AllTheObjectsOfGivenType(typeof(MyObject))
{
...
}
Any suggestions please? Thank you!
David