Hi,
I have a number of queue structures. I want to have multiple instances of these,
i.e Instance 1 Instance 2 Instance 3 ...
------------ ------------ ------------
queueA queueB queueC
I was thinking of usind a structure or a class to store the queues and then having an array of theses structures or classes.
As I am only storing queues what is the best object to hold them, a class, a structue or another data structure?
Thanks
Macca
Darren MarshallPosted May 30, 2006, 1:02 AM
using
System.Collections;private
ArrayList myQueues = new ArrayList();myQueues.Add(queue);
You can then just use it like an array, however since an ArrayList stores them as objects you must cast it back to the correct type before you can use it. Like:
int index = 0;
Queue currentQueue = (Queue)myQueues[index];
you can also remove objects dynamically. Like:
myQueues.RemoveAt(index);
or
myQueues.Remove(); // removes the first object
I think that is what you meant,
Darren