PDA

Click to See Complete Forum and Search --> : Class object collection?


JohnGH
Aug 17th, 2003, 06:36 AM
Can someone tell me what is the best way to create
a collection of objects from classes?

I tried using the component container like it is made
when using components in VS, but it doesn't work.
this.components = new System.ComponentModel.Container();
this.myClass = new theClass(this.components);
The reason I want this is to be able to dispose the
objects created.

JohnGH
Aug 17th, 2003, 06:58 AM
Or is there perhaps a Global Event one can create.

Like a Global_Dispose which runs on all objects when called.

hellswraith
Aug 17th, 2003, 11:31 AM
I don't understand what you are trying to do. If the objects go out of scope, then the built in garbage collector will take care of them. You don't need to do anything. If an object is a huge resource hog, then you should call it's dispose method, and maybe do a forced garbage collection.

JohnGH
Aug 17th, 2003, 12:45 PM
Well I am trying to make a server app which can have multiple
threads and it has plugins. When a session/thread ends it
should dispose the objects/plugins that it used during the
session. This is what I'm trying to do.
What kind of collection should I use for the plugin objects to
be able to dispose them?

Pirate
Aug 17th, 2003, 01:15 PM
HashTable obj maybe !