S
Sagaert Johan
Hi
Is this something for C# V2 ?
Queue msgqueue =new Queue ();
//fill some data in the queue here with this function & keep only the last 5
events
void addtolog(string msg)
{
msgqueue.Enqueue(msg);
if (msgqueue.Count>5)
msgqueue.Dequeue();
}
// print contents of queue without dequeing the data.
foreach (object o in msgqueue )
{
Console.WriteLine((string)o);
}
// printing in reverse :
object[] items=msgqueue.ToArray();
for (int i=items.Length;i>0;i-- )
{
Console.WriteLine((string)items[i-1]);
}
Johan
Is this something for C# V2 ?
Queue msgqueue =new Queue ();
//fill some data in the queue here with this function & keep only the last 5
events
void addtolog(string msg)
{
msgqueue.Enqueue(msg);
if (msgqueue.Count>5)
msgqueue.Dequeue();
}
// print contents of queue without dequeing the data.
foreach (object o in msgqueue )
{
Console.WriteLine((string)o);
}
// printing in reverse :
object[] items=msgqueue.ToArray();
for (int i=items.Length;i>0;i-- )
{
Console.WriteLine((string)items[i-1]);
}
Johan