class Program
{
static void Main(string[] args)
{
List<int> myList = new List<int>();
Queue<int> myQ = new Queue<int>();
Stack<int> myStack = new Stack<int>();
B-) Gerry Lowry, Chief Training Architect, Paradigm Mentors Learning never ends... +1 705-999-9195 wasaga beach, ontario canada TIMTOWTDI =.there is more than one way to do it
Member
2 Points
290 Posts
how to implement a thread safe class queue 's push and pop method using c #
Jul 24, 2014 02:31 PM|hong_ma|LINK
how to implement a thread safe class queue 's push
and pop method,
Thanks,
Hong
Member
251 Points
423 Posts
Re: how to implement a thread safe class queue 's push and pop method using c #
Feb 06, 2015 09:54 AM|Markus33|LINK
Try This!
class Program
{
static void Main(string[] args)
{
List<int> myList = new List<int>();
Queue<int> myQ = new Queue<int>();
Stack<int> myStack = new Stack<int>();
myStack.Push(0); //FILO
myStack.Push(1);
myStack.Push(2);
myStack.Push(3);
myStack.Push(4);
myStack.Push(5);
myStack.Push(6);
myStack.Push(7);
myStack.Push(8);
myStack.Push(9);
int topofStack = myStack.Pop();
Console.WriteLine(topofStack);
myStack.Push(8);
Console.WriteLine("=======================");
foreach (int i in myStack)
{
Console.WriteLine(i);
}
Console.WriteLine("=====================");
Console.Read();
}
}
}
Star
14297 Points
5797 Posts
Re: how to implement a thread safe class queue 's push and pop method using c #
Feb 07, 2015 02:01 PM|gerrylowry|LINK
@hong_ma
one approach could involve using a Singleton for managing your queue.
Implementing Singleton in C# https://msdn.microsoft.com/en-us/library/ff650316.aspx
another approach might be to use message queuing https://msdn.microsoft.com/en-us/library/ms711472(v=vs.85).aspx "Message Queuing (MSMQ)"
TIMTOWTDI