Advertisement
dorabod2006

MQueueClass

Nov 25th, 2014
170
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Collections; //using when want to use arraylist
  7.  
  8. namespace MQueue
  9. {
  10.     class MQueue
  11.     {
  12.         ArrayList list;
  13.         public MQueue() { list = new ArrayList(); }
  14.         public void enqueue(string message) {
  15.             list.Add(message);
  16.         }
  17.         public string dequeue() {
  18.             string message = (string)list[list.Count - 1];
  19.             list.RemoveAt(list.Count - 1);
  20.             return message;
  21.         }
  22.         public bool isempty() {
  23.             return list.Count==0;
  24.         }
  25.  
  26.    
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement