示例#1
0
        static void Main(string[] args)
        {
            GenericList <int> Number = new GenericList <int>();

            Number.Add(1);
            Number.Add(2);
            Number.Add(3);
            Number.Add(5);
            Number.Add(6);

            GenericList <int> AddNumber = new GenericList <int>();

            AddNumber.Add(1);
            AddNumber.Add(2);
            AddNumber.Add(3);
            AddNumber.Add(4);
            AddNumber.Add(5);

            Number.Remove(3);

            Number.ChangeString();

            GenericList <int> CombinedList = Number + AddNumber;

            GenericList <int> RemoveList = Number - AddNumber;

            GenericList <int> Zip = new GenericList <int>();

            Zip.Zipper(Number, AddNumber);

            Number.Count();

            GenericList <string> Animals = new GenericList <string>();

            Animals.Add("Dog");
            Animals.Add("Cat");
            Animals.Add("Cow");
            Animals.Add("Horse");
            Animals.SortList(Animals);

            Console.ReadLine();
        }
示例#2
0
        static void Main(string[] args)
        {
            var list = new GenericList <int>(5);

            list.Add(2);
            list.Add(3);
            list.Add(1);
            list.Add(5);
            list.Add(2);
            list.Add(-1);

            Console.WriteLine(list.IndexOf(1));
            list.Remove(2);

            Console.WriteLine(list.ToString());
            Console.WriteLine(list.Count);

            list.Insert(3, -6);
            Console.WriteLine(list.ToString());
        }
示例#3
0
        static void Main()
        {
            GenericList <int> intList = new GenericList <int>();

            intList.AddElement(5);
            intList.AddElement(10);
            intList.AddElement(15);
            Console.WriteLine(intList);
            intList.InsertElementAt(1, 20);
            Console.WriteLine(intList);
            intList.RemoveElementAtIndex(2);
            Console.WriteLine(intList);
            intList.AddElement(50);
            intList.AddElement(60);
            Console.WriteLine(intList);
            Console.WriteLine("Elements Count: {0}", intList.Count);
            Console.WriteLine("Min: {0}", intList.Min());
            Console.WriteLine("Max: {0}", intList.Max());
            Console.WriteLine(new String('-', 30));
        }
示例#4
0
        public void SortList(GenericList <T> list)
        {
            T temp;

            for (int write = 0; write < newArray.Length; write++)
            {
                for (int sort = 0; sort < newArray.Length - 1; sort++)
                {
                    var result = Comparer <T> .Default.Compare(newArray[sort], newArray[sort + 1]);

                    if (result > 0)
                    {
                        temp = newArray [sort + 1];
                        newArray [sort + 1] = newArray [sort];
                        newArray [sort]     = temp;
                    }
                }
                Console.Write("{0} ", newArray[write]);
            }
        }
示例#5
0
        private static void Main(string[] args)
        {
            var list = new GenericList <int> {
                2, 3, 4, 5, 6, 7, 8, 9, 10
            };

            Console.WriteLine(list.Count);
            list.Add(1);
            Console.WriteLine(list.Count);
            Console.WriteLine(list.Min());
            Console.WriteLine(list.Max());
            Console.WriteLine(list.Contains(11));
            Console.WriteLine(list.FindIndex(3));
            list.Insert(0, 5);
            Console.WriteLine(list);
            list.Remove(0);
            Console.WriteLine(list);
            list.Clear();
            Console.WriteLine(list);
        }
示例#6
0
        static void Main()
        {
            GenericList <int> list = new GenericList <int>(4);

            Console.WriteLine("Added elements:");
            list.Add(38);
            list.Add(22);
            list.Add(12);
            list.Add(53);
            list.Add(55);

            Console.WriteLine(list);

            Console.WriteLine("Element at possition 1: " + list.FindAt(1));

            list.Remove(2);
            Console.WriteLine("\nElements after removing element at possition 2:");
            Console.WriteLine(list);

            list.Insert(2, 11);
            Console.WriteLine("Elements after inserting element at possition 2:");
            Console.WriteLine(list);

            int elementIndex = list.IndexOf(11);

            Console.WriteLine("Index of element with value \"11\": " + elementIndex);;

            bool contains = list.Contains(55);

            Console.WriteLine("\nIf element contains value \"55\"? " + contains);

            Console.WriteLine("\nMin element: " + list.Min());
            Console.WriteLine("\nMax element: " + list.Max());

            var allAttributes = typeof(GenericList <>).GetCustomAttributes(typeof(Version), false);

            Console.WriteLine("\nVersion: " + allAttributes[0]);

            list.Clear();
            Console.WriteLine(list);
        }
示例#7
0
        static void Main()
        {
            GenericList <int> testList = new GenericList <int>();

            testList.Add(5);
            testList.Add(6);
            testList.Add(7);
            testList.Add(9);
            Console.WriteLine("The list contains {0}: {1}", 5, testList.Contains(5));
            testList.InsertAt(4, 3);
            Console.WriteLine("Min: {0}", testList.Min());
            Console.WriteLine("Max: {0}", testList.Max());
            Console.WriteLine(testList);
            GenericList <String> stringList = new GenericList <string>();

            stringList.Add("Pesho");
            stringList.Add("Gosho");
            stringList.Add("Gancho");
            Console.WriteLine(stringList.Contains("Test Three"));
            Console.WriteLine(stringList);
        }
示例#8
0
        static void Main(string[] args)
        {
            GenericList <int> arrayGenerics = new GenericList <int>(10);

            arrayGenerics.AddElement(4);
            arrayGenerics.AddElement(2222);
            arrayGenerics.AddElement(2212);
            arrayGenerics.Clear();
            arrayGenerics.AddElement(4);
            arrayGenerics.AddElement(2);
            arrayGenerics.AddElement(22222);
            arrayGenerics.RemoveElemenByIndext(0);

            arrayGenerics.InsertElement(0, 213321);
            arrayGenerics.RemoveElemenByIndext(0);
            Console.WriteLine(arrayGenerics.ToString());
            Console.WriteLine();

            Console.WriteLine("Max:" + arrayGenerics.Max());
            Console.WriteLine("Min:" + arrayGenerics.Min());
        }
示例#9
0
        public static GenericList <T> operator -(GenericList <T> listOne, GenericList <T> listTwo)
        {
            GenericList <T> newList = MakeCopy(listOne);

            for (int i = 0; i < listTwo.Count; i++)
            {
                int counter = 0;
                while (counter < newList.Count)
                {
                    if (newList[counter].Equals(listTwo[i]))
                    {
                        newList.Remove(listTwo[i]);
                    }
                    else
                    {
                        counter++;
                    }
                }
            }
            return(newList);
        }
示例#10
0
        static void Main()
        {
            GenericList <int> intList = new GenericList <int>();

            intList.Add(1);
            intList.Add(2);
            intList.Add(3);
            Console.WriteLine(intList);
            Console.WriteLine("Element at index 2 is : {0}", intList[2]);
            Console.WriteLine("Dooes the list contain 1 : {0}", intList.Find(1));
            Console.WriteLine("The index if value 3 is : {0}", intList.FindIndex(3));
            intList.InsertAt(8, 2);
            Console.WriteLine(intList);
            intList.RemoveAt(2);
            Console.WriteLine(intList);
            //intList.ClearAll();
            //Console.WriteLine(intList);
            Console.WriteLine("Max Value : {0}", intList.Max());
            Console.WriteLine("Min Value : {0}", intList.Min());
            Console.ReadKey();
        }
示例#11
0
        static void Main(string[] args)
        {
            Console.WriteLine("list 1:\n");
            var l1 = new GenericList <double>();

            Console.WriteLine(l1);
            l1.Add(3.6);
            l1.Add(9.9);
            Console.WriteLine(l1);
            l1.RemoveAt(1);
            Console.WriteLine(l1);

            Console.WriteLine("\n\nlist 2:\n");
            var l2 = new GenericList <Person>();

            Console.WriteLine(l2);
            l2.Add(new Person("Name1", 15));
            l2.Add(new Person("Name2", 20));
            Console.WriteLine(l2);
            l2.RemoveAt(1);
            Console.WriteLine(l2);
        }
示例#12
0
        static void Main()
        {
            GenericList <int> newList = new GenericList <int>(3);

            newList.Add(5);
            newList.Add(4);
            newList.Add(6);
            newList.Add(7);

            Console.WriteLine(newList[2]);
            newList[1] = 10;
            Console.WriteLine(newList[2]);

            newList.RemoveAtPsn(2);
            Console.WriteLine(newList[2]);

            Console.WriteLine(newList.MinValue());
            Console.WriteLine(newList.MaxValue());

            newList.ClearList();
            Console.WriteLine();
        }
示例#13
0
        public static void Main()
        {
            var customAttributes = typeof(GenericList <>).GetCustomAttributes(typeof(VersionAttribute), true);

            Console.WriteLine("This GenericList<T> class's version is {0}", customAttributes[0]);

            GenericList <int> numbers = new GenericList <int>();

            numbers.Add(1);
            numbers.Add(2);
            numbers.Add(3);
            numbers.Add(4);
            numbers.Add(5);
            numbers.Add(6);
            numbers.Add(7);
            numbers.Add(8);
            numbers.Add(9);
            numbers.Add(10);

            Console.WriteLine("GenericList : {0}", numbers);
            Console.WriteLine("Index of 6 : {0}", numbers.IndexOf(6));
            Console.WriteLine("Capacity : {0}", numbers.Capacity);
            Console.WriteLine("Size : {0}", numbers.Size);
            Console.WriteLine();

            numbers.Remove(3);      // remove element at index 3
            numbers.Insert(100, 4); // insert number 100 at index 4
            Console.WriteLine("GenericList : {0}", numbers);
            Console.WriteLine("Size : {0}", numbers.Size);
            Console.WriteLine();

            for (int i = 0; i < 10; i++)
            {
                numbers.Add(i * 3);
            }

            Console.WriteLine("GenericList : {0}", numbers);
            Console.WriteLine("Capacity : {0}", numbers.Capacity);
        }
示例#14
0
        public static void ListExampleDouble(GenericList <double> listOfDoubles)
        {
            listOfDoubles.Add(1.1);                       // [1.1]
            listOfDoubles.Add(2.2);                       // [1.1 ,2.2]
            listOfDoubles.Add(3.3);                       // [1.1 ,2.2 ,3.3]
            listOfDoubles.Add(4.4);                       // [1.1 ,2.2 ,3.3 ,4.4]
            listOfDoubles.Add(5.5);                       // [1.1 ,2.2 ,3.3 ,4.4 ,5.5]
            listOfDoubles.Add(6.6);
            listOfDoubles.RemoveAt(0);                    // [2.2 ,3.3 ,4.4 ,5.5,6.6]
            listOfDoubles.Remove(5.5);                    //[2.2, 3.3, 4.4, 6.6]
            Console.WriteLine(listOfDoubles.Count);       // 4
            Console.WriteLine(listOfDoubles.Remove(100)); // false
            Console.WriteLine(listOfDoubles.RemoveAt(5)); // false

            foreach (double el in listOfDoubles)
            {
                Console.WriteLine(el);
            }

            listOfDoubles.Clear();                  // []
            Console.WriteLine(listOfDoubles.Count); // 0
        }
示例#15
0
        static void Main(string[] args)
        {
            var customAttributes = typeof(GenericList <>).GetCustomAttributes(typeof(VersionAttribute), false);

            Console.WriteLine("This GenericList<T> class's version is {0}", customAttributes);
            GenericList <int> genericListInt = new GenericList <int>();

            genericListInt.Add(1);
            genericListInt.Add(2);
            genericListInt.Add(3);
            genericListInt.Add(4);
            genericListInt.Add(321315);
            genericListInt.Add(6);
            genericListInt.Add(7);
            genericListInt.InsertAt(10, 2);
            genericListInt.InsertAt(10, 2);
            genericListInt.Add(8);
            genericListInt.InsertAt(10, 2);
            if (genericListInt.Contains(321315))
            {
                Console.WriteLine("true");
            }

            Console.WriteLine("genericListInt Count = " + genericListInt.Count);
            GenericList <string> genericListString = new GenericList <string>();

            genericListString.Add("Pesho");
            genericListString.RemoveAt(1);
            genericListString.Add("Angel");
            genericListString.Add("Pesho");
            genericListString.InsertAt("Todor", 2);
            int m = genericListString.Find("Todor");

            Console.WriteLine("Fint at position " + m);
            Console.WriteLine("MIN => " + genericListInt.Min());
            Console.WriteLine("MAX => " + genericListInt.Max());
            Console.WriteLine(genericListString);
        }
示例#16
0
        static void Main()
        {
            var myList = new GenericList <int>();
            var rd     = new Random();

            for (var i = 1; i <= 10; i++)
            {
                myList.Add(rd.Next(0, 100));
                Console.Write($"{myList.Tail.Data} ");
            }
            Console.WriteLine();
            var sum = 0;
            var max = int.MinValue;
            var min = int.MaxValue;

            myList.ForEach(x =>
            {
                sum += x;
                max  = Math.Max(max, x);
                min  = Math.Min(min, x);
            });
            Console.WriteLine($"Sum is {sum}, max is {max}, min is {min}");
        }
示例#17
0
        public static void Test()
        {
            var myList = new GenericList <int>(20);

            myList.Add(5);
            myList[0] = 6;
            myList.Add(8);
            Console.WriteLine(myList.IndexOf(6));
            Console.WriteLine(myList.ToString("s s"));

            myList.Remove(2);
            myList.Add(4);

            Console.WriteLine(myList.ToString());

            Console.WriteLine(myList.Min());
            Console.WriteLine(myList.Max());

            Console.WriteLine(myList.NextIndex);

            myList.Clear();
            Console.WriteLine(myList.ToString());
        }
示例#18
0
        public static void Main()
        {
            GenericList <string> list = new GenericList <string>();              // Problem 5

            Console.WriteLine("Empty GenericList");
            Console.WriteLine(list);
            Console.WriteLine("List capacity: {0}\n", list.Capacity);

            Console.WriteLine("Adding elements to GenericList");
            list.AddElement("first");
            list.AddElement("second");
            list.AddElement("third");
            list.AddElement("fourth");
            list.AddElement("fifth");
            Console.WriteLine(list);

            Console.WriteLine("Removing an element at index [1]:");
            list.RemoveElementAt(1);
            Console.WriteLine(list);

            Console.WriteLine("Inserting an element \"inserted\"");
            list.InsertElementAt(2, "inserted");
            Console.WriteLine(list);

            Console.WriteLine("Element \"{0}\" is at index {1}\n", "fifth", list.FindElement("fifth"));
            Console.WriteLine("List capacity: {0}\n", list.Capacity);

            Console.WriteLine("Getting an element at index [2] -> \"{0}\"\n", list[2]);

            Console.WriteLine("Getting the minimal element: \"{0}\"\n", list.Min());      // Problem 7
            Console.WriteLine("Getting the maximal element: \"{0}\"\n", list.Max());      // Problem 7

            Console.WriteLine("Clearing the list...");
            list.ClearGenericList();
            Console.WriteLine(list);
            Console.WriteLine("List capacity: {0}\n", list.Capacity);
        }
示例#19
0
文件: Test.cs 项目: K-Pavlov/Telerik
        public static int Main()
        {
            GenericList <int> list = new GenericList <int>(20);

            for (int i = 0; i <= 45; i++)
            {
                list.AddElement(i + 5);
            }
            list.RemoveElement(5);
            Console.Write("Elements: ");
            for (int i = 0; i <= list.Size() - 1; i++)
            {
                Console.Write(list.GetElement((uint)i));
                if (i < list.Size() - 1)
                {
                    Console.Write(",");
                }
            }
            Console.WriteLine("\n{0}", list.FindElementByVal(40));
            Console.WriteLine(list.Min());
            Console.WriteLine(list.Max());
            Console.WriteLine(list.ToString());
            return(0);
        }
示例#20
0
        static void Main(string[] args)
        {
            int[]             array = { 1, 2, 3, 4, 5 };
            GenericList <int> gl    = new GenericList <int>();

            for (int i = 0; i < 5; i++)
            {
                gl.Add(array[i]);
            }
            int sum = 0, maxValue = gl.Head.Value, minValue = gl.Head.Value;

            //Action<int> computeSum = x => { sum += x; };
            //Action<int> computeMax = x => { maxValue = Math.Max(maxValue, x); };
            //Action<int> computeMin = x => { minValue = Math.Min(minValue, x); };
            gl.ForEach(x =>
            {
                Console.Write(x + " ");
                sum     += x;
                maxValue = Math.Max(maxValue, x);
                minValue = Math.Min(minValue, x);
            });
            Console.WriteLine(" Sum: " + sum + " Max: " + maxValue + " Min: " + minValue);
            string stop = Console.ReadLine();
        }
示例#21
0
        static void Main(string[] args)
        {
            GenericList <string> list1 = new GenericList <string>(5);

            list1.AddElement("Gogo");
            list1.AddElement("Igrae");
            list1.AddElement("Futball");
            list1.DeleteElement(2);
            Console.WriteLine(list1.MyToString());
            list1.AddElement("gogo");
            list1.AddElement("gogo");
            list1.AddElement("gogo");
            list1.AddElement("gogo");
            list1.AddElement("gogo");
            list1.AddElement("gogo");
            list1.AddElement("gogo");
            list1.AddElement("gogo");
            list1.AddElement("gogo");
            list1.AddElement("gogo");
            list1.AddElement("gogo");
            list1.AddElement("gogo");
            Console.WriteLine(list1.MyToString() + " " + list1.Length);
            Console.WriteLine(list1.EmptyIndexes);
        }
示例#22
0
        static void Main()
        {
            Console.WriteLine("Hello World.");
            Console.WriteLine("Make new List.");
            GenericList <float> newList = new GenericList <float>(20);

            Console.WriteLine("Add some numbers to the List - 5.3, 6.27, 7.55, 8, 9.09");
            newList.AddElement(5.3f);
            newList.AddElement(6.27f);
            newList.AddElement(7.55f);
            newList.AddElement(8f);
            newList.AddElement(9.09f);
            Console.WriteLine("Print Max element: {0}", newList.Max());
            Console.WriteLine("Print Min element: {0}", newList.Min());
            Console.WriteLine("Add 10 in the biggining.");
            newList.InsertElement(0, 10);
            Console.WriteLine("Print Max element again: {0}", newList.Max());
            Console.WriteLine("Print the List.");
            Console.WriteLine(newList);
            Console.WriteLine("Remove the fourth element.");
            newList.RemoveElement(3);
            Console.WriteLine("Print the List.");
            Console.WriteLine(newList);
            Console.WriteLine("Remove the fourth element.");
            newList.RemoveElement(3);
            Console.WriteLine("Print the List.");
            Console.WriteLine(newList);
            Console.WriteLine("Remove the fourth element.");
            newList.RemoveElement(3);
            Console.WriteLine("Print the List.");
            Console.WriteLine(newList);
            Console.WriteLine("Add 15.56 in the end.");
            newList.InsertElement(3, 15.56f);
            Console.WriteLine("Print the List.");
            Console.WriteLine(newList);
        }
示例#23
0
 public GenericListEnumerator(GenericList <T> genericList)
 {
     this.genericList = genericList;
 }
示例#24
0
 public GenericListEnumerator(GenericList <T> list)
 {
     listOfGenerics = list;
     position       = -1;
 }
示例#25
0
        static void Main()
        {
            // Making a generic list and adding values to its elements
            GenericList <string> newList = new GenericList <string>(5);

            newList.Add("one");
            newList.Add("two");
            newList.Add("three");
            newList.Add("four");
            newList.Add("five");
            // Printing all alament from the generic list
            Console.WriteLine("The values of the elements in the generic list are:");
            for (int i = 0; i < newList.Length; i++)
            {
                Console.WriteLine("Element[{0}]: {1}", i, newList[i]);
            }
            // Testing the indexer. Changing the value of the first element
            Console.WriteLine("The value of element[0] is: " + newList[0]);
            newList[0] = "zero";
            Console.WriteLine("The value of element[0] after the change is: " + newList[0]);
            // Removing an element
            newList.Remove(3);
            Console.WriteLine("The value of element[3] is: " + newList[3]);
            // Testing the length property
            Console.WriteLine("The length of the list is: " + newList.Length);
            // Testing the insert method
            Console.WriteLine("The value of element[2] is: " + newList[2]);
            newList.Insert(2, "zero");
            Console.WriteLine("The value of element[2] after the insert is: " + newList[2]);
            // Testing the find method
            int result = newList.Find("two");

            Console.WriteLine("\"two\" is at index: {0}", result);
            int secondResult = newList.Find("three");

            Console.WriteLine("\"three\" is at index: {0}", secondResult);
            // Testing the ToString() override
            Console.WriteLine("The values of the elements in the generic list after all changes are:");
            Console.WriteLine(newList.ToString());
            // Testing the clear method
            newList.Clear();
            Console.WriteLine("The values of the elements in the generic list after clearing it are:");
            for (int i = 0; i < newList.Length; i++)
            {
                Console.WriteLine("Element[{0}]: {1}", i, newList[i]);
            }
            // Testing the auto-grow method
            newList.Add("six");
            Console.WriteLine("The length of the generic list after the auto-grow is: " + newList.Length);
            // Adding values and testing the min and max methods
            newList.Insert(0, "one");
            newList.Insert(1, "two");
            newList.Insert(2, "three");
            newList.Insert(3, "four");
            newList.Insert(4, "five");
            newList.Insert(5, "six");
            newList.Insert(6, "seven");
            newList.Insert(7, "eight");
            newList.Insert(8, "nine");
            newList.Insert(9, "ten");
            string maxResult = newList.Max();

            Console.WriteLine("The longest element in the generic list is: " + maxResult);
            string minResult = newList.Min();

            Console.WriteLine("The shortest element in the generic list is: " + minResult);
        }
示例#26
0
        static void Main(string[] args)
        {
            var genericList  = new GenericList <int>();
            var deletedItems = new GenericList <int>();

            for (int i = 1; i <= 100; i++)
            {
                genericList.Add(i);
            }
            genericList.ItemWasRemoved += ItemWasRemoved;

            Console.WriteLine($"Number of items in list: {genericList.Count}");
            Console.WriteLine($"List capacity: {genericList.Capacity}");
            for (int i = 0; i < genericList.Count; i++)
            {
                Console.WriteLine(genericList[i]);
            }

            genericList.ItemWasRemoved += delegate(int data)
            {
                deletedItems.Add(data);
            };

            genericList.RegisterOnMyFilter(NotEvenNumber);

            GenericList <int> newList = genericList.FilterList(genericList);

            Console.WriteLine("try");

            Console.WriteLine("Loop with foreach");
            foreach (var item in newList)
            {
                Console.WriteLine(item);
            }


            Console.WriteLine($"Removing index 4 with value {genericList[4]}");
            genericList.RemoveAtIndex(4);

            Console.WriteLine($"Number of items in list: {genericList.Count}");
            Console.WriteLine($"List capacity: {genericList.Capacity}");
            for (int i = 0; i < genericList.Count; i++)
            {
                Console.WriteLine(genericList[i]);
            }


            Console.ReadKey();

            void ItemWasRemoved <T>(T data)
            {
                Console.WriteLine($"Item {data} was removed from the list");
            }

            GenericList <int> NotEvenNumber(GenericList <int> list)
            {
                GenericList <int> newFilteredList = list;

                foreach (var item in newFilteredList)
                {
                    if ((int)item % 2 == 0)
                    {
                        list.RemoveAtIndex(2);
                    }
                }
                return(newFilteredList);
            }
        }
示例#27
0
 public GenericListEnumerator(GenericList <T> collection)
 {
     _collection  = collection;
     currentIndex = -1;
     curT         = default(T);
 }
示例#28
0
        static void Main()
        {
            var myList = new GenericList <int>();

            //print empty list
            Console.WriteLine(myList);

            //test Add and Resize
            myList.Add(1);
            myList.Add(2);
            myList.Add(7);
            myList.Add(11);
            myList.Add(23);
            myList.Add(22);
            myList.Add(33);
            myList.Add(45);
            myList.Add(84);
            myList.Add(16);
            myList.Add(76);
            myList.Add(90);
            myList.Add(99);
            myList.Add(19);
            myList.Add(34);
            myList.Add(71);
            myList.Add(21);
            myList.Add(100);
            Console.WriteLine(myList);

            //test RemoveAt
            myList.RemoveAt(0); //at valid position
            Console.WriteLine(myList);
            //myList.RemoveAt(-1); //at invalid position
            //Console.WriteLine(myList);

            //test AccessAt
            Console.WriteLine(myList.AccessAt(3)); //at valid position
            //Console.WriteLine(myList.AccessAt(50)); //at invalid position

            //test InsertAt
            myList.InsertAt(200, 30);
            Console.WriteLine(myList);
            myList.InsertAt(999, 0);
            Console.WriteLine(myList);
            myList.InsertAt(111, 10);
            Console.WriteLine(myList);
            //myList.InsertAt(222, -3);
            //Console.WriteLine(myList);

            //test Clear
            //myList.Clear();
            //Console.WriteLine(myList);

            //test Find
            Console.WriteLine(myList.Find(200));
            Console.WriteLine(myList.Find(-2));

            //test Contain
            Console.WriteLine(myList.Contain(200));
            Console.WriteLine(myList.Contain(-200));

            //test Min
            Console.WriteLine(myList.Min());

            //test Max
            Console.WriteLine(myList.Max());

            //test Version
            Type type = typeof(GenericList <>);

            object[] allAttributes = type.GetCustomAttributes(typeof(VersionAttribute), false);
            Console.WriteLine("GenericsList's version is {0}", ((VersionAttribute)allAttributes[0]).Version);
        }
示例#29
0
 public GenericListEnumerator(GenericList <T> genericList)
 {
     this.genericList = genericList;
     this.index       = -1;
 }
示例#30
0
 public GenericListEnumerator(GenericList <T> list)
 {
     this.list = list;
 }