Example #1
0
 public int Dequeue()
 {
     if (firstItem != null)
     {
         var returnItem = firstItem.Value;
         firstItem = firstItem.NextItem;
         return returnItem.Value;
     }
     throw new ActionNotAllowedException();
 }
Example #2
0
 public void Enqueue(int i)
 {
     if (firstItem == null)
     {
         firstItem = new item(i);
         lastItem = firstItem;
     }
     else
     {
         var newItem = new item(i);
         lastItem.NextItem = newItem;
         lastItem = newItem;
     }
 }