public NateList <T> Zipper(NateList <T> listTwo) { NateList <T> currentArray = new NateList <T>(); for (int i = 0; i < count && i < listTwo.count; i++) { currentArray.Add(list[i]); currentArray.Add(listTwo[i]); } if (count > listTwo.count) { for (int j = count; j < (count - listTwo.count); j++) { currentArray.Add(list[j]); } } else if (listTwo.count > count) { for (int k = listTwo.count; k < (listTwo.count - count); k++) { currentArray.Add(listTwo[k]); } } this.list = currentArray.list; this.count = currentArray.count; return(currentArray); }
static void Main(string[] args) { NateList <string> myList = new NateList <string>(); myList.Add("this"); myList.Add("that"); myList.Add("those"); myList.Add("things"); myList.Remove("that"); myList.Remove("those"); }
public static NateList <T> operator +(NateList <T> listOne, NateList <T> listTwo) { NateList <T> newList = new NateList <T>(); newList.list = listOne.list; newList.count = listOne.count; for (int i = 0; i < listTwo.count; i++) { newList.Add(listTwo.list[i]); } return(newList); }
public NateList <T> Remove(T item) { NateList <T> currentArray = new NateList <T>(); for (int i = 0; i < count; i++) { if (list[i].Equals(item) == false) { currentArray.Add(list[i]); } } this.list = currentArray.list; this.count = currentArray.count; return(currentArray); }
public static NateList <T> operator -(NateList <T> listOne, NateList <T> listTwo) { NateList <T> newList = new NateList <T>(); newList = listOne; bool isMatch; for (int i = 0; i < listTwo.count; i++) { isMatch = false; for (int j = 0; j < listOne.count; j++) { if (listOne[j].Equals(listTwo.list[i]) == true) { isMatch = true; } } if (isMatch == false) { newList.Add(listTwo.list[i]); } } return(newList); }