Beispiel #1
0
        public static void Demo()
        {
            var mylist = new MyLinkedList <object>();

            mylist.PrintList();
            mylist.AddFirst(1);
            mylist.AddFirst(2);
            mylist.AddFirst(3);
            mylist.AddLast(4);
            mylist.AddLast(6);
            mylist.AddLast("Basant");
            mylist.AddFirst("abc");
            mylist.PrintList();

            Console.WriteLine("printing for each");
            foreach (var item in mylist)
            {
                Console.WriteLine(item);
            }
            Console.WriteLine("for each completed..");

            var arr = new object[10];

            mylist.CopyTo(arr, arr.Length);

            Console.WriteLine(arr[6]);
            mylist.Remove("Basant");
            mylist.PrintList();
            while (mylist.Count > 0)
            {
                mylist.RemoveLast();
                mylist.PrintList();
            }
        }
Beispiel #2
0
        public static void Main()
        {
            MyLinkedList mll = new MyLinkedList(10);

            mll.AddFirst(11);
            mll.AddFirst(12);
            mll.AddFirst(13);

            mll.Add(4, 8);
            mll.Add(4, 9);
            mll.PrintList();
        }
Beispiel #3
0
 public void PrintStackItems()
 {
     _stack.PrintList();
 }