Esempio n. 1
0
        static void Main(string[] args)
        {
            LinkedList <int> myList = new LinkedList <int>();

            myList.Add(10);
            myList.Add(11);

            Console.WriteLine(myList.Count());
            myList.RemoveAt(1);
            Console.WriteLine(myList.Count());

            myList.Add(12);
            myList.Add(13);
            myList.Add(14);

            Console.WriteLine(myList.Count());

            myList.RemoveAt(1);
            myList.RemoveAt(1);

            Console.WriteLine(myList.Count());

            myList.RemoveAt(0);


            Console.WriteLine(myList.Count());
            Console.ReadLine();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            LinkedList <int> linkedList = new LinkedList <int>();

            linkedList.Add(5);
            linkedList.Add(6);
            linkedList.Add(12);
            linkedList.Add(77);
            linkedList.Add(88);

            linkedList.Remove(6);
            linkedList.Remove(77);
            linkedList.Add(99);
            linkedList[1] = 33;
            linkedList.RemoveAt(2);
            Console.WriteLine(linkedList.Remove(5));


            LinkedList <int> test = new LinkedList <int>();

            for (int i = 0; i < 10; i++)
            {
                test.Add(i);
            }

            for (int i = 0; i < test.Count; i++)
            {
                Console.WriteLine(test[i]);
            }

            test.Reverse();
            Console.WriteLine();

            for (int i = 0; i < test.Count; i++)
            {
                Console.WriteLine(test[i]);
            }


            Console.ReadLine();
        }