public static Marbles <T> operator -(Marbles <T> list1, Marbles <T> list2) { Marbles <T> marblesArray = new Marbles <T>(); Marbles <T> tempArray = new Marbles <T>(); Marbles <T> tempList1 = new Marbles <T>(); Marbles <T> tempList2 = new Marbles <T>(); for (int i = 0; i < list1.Count; i++) { marblesArray.Add(list1[i]); } for (int i = 0; i < list2.Count; i++) { marblesArray.Add(list2[i]); } for (int i = 0; i < list1.Count; i++) { var valueToCheck1 = list1[i]; for (int j = 0; j < list2.Count; j++) { if (list1[i].Equals(list2[j])) { marblesArray.Remove(list1[i]); break; } } } return(marblesArray); }
static void Main(string[] args) { Marbles <int> list = new Marbles <int>(); list.Add(4); Console.WriteLine(list[0]); Console.ReadLine(); }
public static Marbles <T> operator +(Marbles <T> list1, Marbles <T> list2) { Marbles <T> marblesArray = new Marbles <T>(); for (int i = 0; i < list1.Count; i++) { marblesArray.Add(list1[i]); } for (int i = 0; i < list2.Count; i++) { marblesArray.Add(list2[i]); } return(marblesArray); }
public Marbles <T> ZipTwoLists(Marbles <T> ListOdds, Marbles <T> ListEvens) { Marbles <T> marblesArray = new Marbles <T>(); int fullCountMass = (ListOdds.Count + ListEvens.Count); int fullCount = (fullCountMass / 2); int indexTracker = 0; for (int i = 0; i < fullCount; i++) { if (ListOdds[indexTracker] != null) { Add(ListOdds[indexTracker]); } if (ListEvens[indexTracker] != null) { Add(ListEvens[indexTracker]); } indexTracker++; } return(marblesArray); }