Implementing a queue in a wrapper class --- please help...

A

almurph

Hi,

I'm using ASP.NET 2.0 and have to implement a queue object. That's no
problem - its just:

Queue myQueue<object> = new Queue<object>();

The thing is though - I want to make this queue available through a
wrapper class (so its available to everything) but I dont know how to
do this. can you assist? You know i want to use getters and setters or
is this applicable? Any comments/suggestions/help/code-sampels much
appreciated.

Thank you,
Al.
 
P

Peter Ritchie [C# MVP]

Why do you want a wrapper class? Why not simply expose a Queue<object>
property/member?
 
S

sloan

I think its the simple setup below.
Am I missing something?

Do you want "object" to be a Generic?


public class MyWrapper
{


private Queue _myQueue<object> = new Queue<object>();


public Queue TheQueue//bad naming convention here

{

get { return _myQueue; }

set { _myQueue= value; }

}





}


//

MyWrapper w = new MyWrapper();
w.TheQueue.Dequeue(); //?? whatever the methods are
 
I

Ignacio Machin ( .NET/ C# MVP )

Hi,

        I'm using ASP.NET 2.0 and have to implement a queue object.. That's no
problem - its just:

        Queue myQueue<object> = new Queue<object>();

        The thing is though - I want to make this queue available through a
wrapper class (so its available to everything) but I dont know how to
do this. can you assist? You know i want to use getters and setters or
is this applicable? Any comments/suggestions/help/code-sampels much
appreciated.

Thank you,
Al.

Hi,

Are you refering to a singleton?
Take a look at Jon's Skeet article about how to best implement a
singleton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top