예제 #1
0
        public static void Main()
        {
            GenericList <int> list = new GenericList <int>();

            list.Add(1);
            list.Add(2);
            list.Add(3);
            list.Add(4);
            list.Add(5);
            Console.WriteLine("Making a new list:\n " + list);

            Console.WriteLine("Inserting a number 6 at position 2!");
            list.Insert(2, 6);
            Console.WriteLine(list);

            Console.WriteLine("The position of number 3 is {0}!", list.IndexOf(3));

            Console.WriteLine("Remove an element on position 3.");
            list.RemoveAt(3);
            Console.WriteLine(list);

            Console.WriteLine("The MIN element in the list is {0}", list.Min());
            Console.WriteLine("The MAX element in the list is {0}", list.Max());

            list.Clear();

            Console.WriteLine("The list after list.Clear()! \n" + list);

            //Console.WriteLine(list.Min());
        }
예제 #2
0
        static void Main()
        {
            var list = new GenericList <int>(5);

            list.Add(10);
            list.Add(34);
            list.Add(27);

            list.Insert(1, 23);
            list.Insert(1, 443);
            list.Insert(1, 463);

            Console.WriteLine(list);

            Console.WriteLine(list.Min());
            Console.WriteLine(list.Max());
        }
예제 #3
0
        public static void Main()
        {
            var myListInt = new GenericList <int>();

            myListInt.Add(2);
            myListInt.Add(5);
            myListInt.Add(16);
            myListInt.Add(78);
            myListInt.Add(52);
            myListInt.Add(9);

            Console.WriteLine("Min element in list is: {0}", myListInt.Min());
            Console.WriteLine();
            Console.WriteLine("Max element in list is: {0}", myListInt.Max());
            Console.WriteLine();

            var myListString = new GenericList <string>();

            myListString.Add("Ivan");
            myListString.Add("Petar");
            myListString.Add("Georgi");
            myListString.Add("Todor");
            myListString.Add("Stoyan");

            Console.WriteLine(myListString[4]);
            Console.WriteLine();

            Console.WriteLine(myListString.ToString());
            Console.WriteLine();

            myListString[4] = "Soyancho";

            myListString.Insert(3, "Angel");

            Console.WriteLine(myListString.ToString());

            Console.WriteLine();

            myListString.Delete(1);

            Console.WriteLine(myListString.ToString());
            Console.WriteLine();

            myListString.Clear();

            Console.WriteLine(myListString.ToString());
            Console.WriteLine();
        }
예제 #4
0
        static void Main()
        {
            var list = new GenericList <int>(5);

            list.Add(5);
            list.Add(10);
            list.Add(20);

            list.Insert(1, 123);

            list.Add(-100);

            Console.WriteLine(list);

            Console.WriteLine(list.Min());
            Console.WriteLine(list.Max());
        }