static void Main(string[] args) { GenericList <string> clothingList = new GenericList <string>(); clothingList.Add("Shirt"); clothingList.Add("Pants"); clothingList.Add("Shoes"); clothingList.Add("Hat"); clothingList.Remove("Shirt"); clothingList.Remove("Pants"); clothingList.Remove("Shoes"); Console.WriteLine(clothingList); Console.ReadLine(); GenericList <int> amountOfClothing = new GenericList <int>(); amountOfClothing.Add(3); amountOfClothing.Add(2); amountOfClothing.Add(4); amountOfClothing.Add(2); /*List<int> intList = new List<int>() { 1, 2 }; * int howMany = intList.Count;*/ // Transfer all the data from array1 to array2 /* int[] array1 = new int[3] { 1, 2, 3 }; * int[] array2 = new int[6]; * * for (int i = 0; i < array1.Length; i++) * { * array2[i] = array1[i]; * }*/ //int[] array3 = new int[array1.Length + array2.Length]; //for (int i = 0; i < array3.Length; i++) //{ //array1 = array2; //} }
static void Main(string[] args) { GenericList <int> myList = new GenericList <int>(); myList.Add(1); myList.Add(2); myList.Add(3); myList.Add(4); myList.Add(15); myList.Add(6); myList.Add(1); myList.Add(1); myList.Add(1); myList.Add(1); myList.Add(1); myList.Add(1); myList.Add(6); myList.Add(6); myList.Add(6); myList.Add(6); myList.Add(6); myList.Add(6); myList.Add(-1); Console.WriteLine(myList.Max()); Console.WriteLine(myList.Min()); Console.WriteLine(myList[3]); myList.Remove(15); myList[0] = 50; myList.Sort(); Console.WriteLine(myList); myList.Reverse(); Console.WriteLine(myList); Console.WriteLine(myList.Contains(1000)); }
static void Main() { GenericList <string> alphabet = new GenericList <string>(); GenericList <string> addedList = new GenericList <string>(); GenericList <int> subtractedList = new GenericList <int>(); GenericList <int> zippedList = new GenericList <int>(); GenericList <int> testList = new GenericList <int>(); GenericList <int> testList2 = new GenericList <int>(); for (int i = 0; i < 10; i++) { testList.AddToList(2); testList.AddToList(1); testList.AddToList(3); testList.AddToList(2); testList2.AddToList(1); testList2.AddToList(2); testList2.AddToList(3); alphabet.AddToList("NOSE"); alphabet.AddToList("OLD"); alphabet.AddToList("POTATO"); alphabet.AddToList("QUIL"); alphabet.AddToList("RABBIT"); alphabet.AddToList("SNAIL"); alphabet.AddToList("TURTLE"); alphabet.AddToList("UMBRELLA"); alphabet.AddToList("VOLE"); alphabet.AddToList("WOLF"); alphabet.AddToList("XYLOPHONE"); alphabet.AddToList("YAWN"); alphabet.AddToList("ZEBRA"); alphabet.AddToList("ANIMAL"); alphabet.AddToList("BEAVER"); alphabet.AddToList("COW"); alphabet.AddToList("DOG"); alphabet.AddToList("ELEPHANT"); alphabet.AddToList("FARM"); alphabet.AddToList("GARY"); alphabet.AddToList("HOWARD"); alphabet.AddToList("ISRAEL"); alphabet.AddToList("JIMMY"); alphabet.AddToList("KOHLS"); alphabet.AddToList("LEMON"); alphabet.AddToList("MANDRIN"); } alphabet.SortThisList(); testList.SortThisList(); testList.SortThisList(); alphabet.PrintArray(); testList.ConvertToString(); testList2.ConvertToString(); testList.RemoveFromListByValue(2); testList2.RemoveFromListByValue(1); testList.PrintArray(); testList2.PrintArray(); testList.ConvertToString(); testList2.ConvertToString(); addedList = testList + testList2; addedList.PrintArray(); subtractedList = testList - testList2; subtractedList.PrintArray(); zippedList = testList2.Zip(testList, testList2); zippedList.PrintArray(); Console.ReadLine(); }
static void Main(string[] args) { Type type = typeof(GenericList <>); object[] allAttributes = type.GetCustomAttributes(false); foreach (var version in allAttributes) { if (version is CurrVersion) { Console.WriteLine(version); } } Console.WriteLine(new string('-', 50)); GenericList <int> myList = new GenericList <int>(); myList.Add(1); myList.Add(2); myList.Add(3); myList.Add(4); myList.Add(15); myList.Add(6); myList.Add(1); myList.Add(1); myList.Add(1); myList.Add(1); myList.Add(1); myList.Add(1); myList.Add(6); myList.Add(6); myList.Add(6); myList.Add(6); myList.Add(6); myList.Add(6); myList.Add(-1); Console.WriteLine(myList.Max()); Console.WriteLine(myList.Min()); Console.WriteLine(myList[3]); myList.Remove(15); myList[0] = 50; myList.Sort(); Console.WriteLine(myList); myList.Reverse(); Console.WriteLine(myList); Console.WriteLine(myList.Contains(1000)); try { Console.WriteLine(myList[34]); } catch (IndexOutOfRangeException ex) { Console.WriteLine("Exception: {0}", ex.Message); } }