How to make a generic Queue array?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all,

I would like to make a generic Queue arrry in C# like below.
Queue<int> [] queue = new Queue<int> ()[10];

But the compiler keep complaining about the part and honestly I don't know
how to make it right.

Can you give me a tip on how to do it?

Thanks,
 
Back 9 said:
Hi all,

I would like to make a generic Queue arrry in C# like below.
Queue<int> [] queue = new Queue<int> ()[10];

You have to add each queue to the array, one at a time. Like:

---8<---
Queue<int>[] queues = new Queue<int>[10]; // array of null queues
for (int i = 0; i < 10; ++i)
queues = new Queue<int>();
--->8---

-- Barry
 
Back
Top