470,866 Members | 1,930 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,866 developers. It's quick & easy.

How to make a generic Queue array?

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,
Jun 21 '06 #1
1 1285
Back 9 <Ba***@discussions.microsoft.com> wrote:
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[i] = new Queue<int>();
--->8---

-- Barry

--
http://barrkel.blogspot.com/
Jun 21 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by INeedADip | last post: by
22 posts views Thread by Adam Clauss | last post: by
4 posts views Thread by Adam Clauss | last post: by
1 post views Thread by A. Burch | last post: by
2 posts views Thread by =?Utf-8?B?TWluIFlvbmc=?= | last post: by
3 posts views Thread by =?Utf-8?B?Y2hyaXNiZW4=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.