Exemple #1
0
        public static ListMethod <T> operator+(ListMethod <T> list1, ListMethod <T> list2)
        {
            ListMethod <T> combinedList = new ListMethod <T>();

            for (int i = 0; i < list1.Count; i++)
            {
                combinedList.Add(list1[i]);
            }
            for (int i = 0; i < list2.Count; i++)
            {
                combinedList.Add(list2[i]);
            }
            return(combinedList);
        }
Exemple #2
0
        public ListMethod <T> Zip(ListMethod <T> listTwo)
        {
            ListMethod <T> newList = new ListMethod <T>();
            int            i       = 0;

            do
            {
                if (i < count)
                {
                    newList.Add(newArray[i]);
                }
                if (i < listTwo.Count)
                {
                    newList.Add(listTwo[i]);
                }
                i++;
            } while (count > i || listTwo.Count > i);
            return(newList);
        }
Exemple #3
0
        public static ListMethod <T> operator-(ListMethod <T> list1, ListMethod <T> list2)
        {
            ListMethod <T> subtractedList = new ListMethod <T>();
            bool           isFound;

            foreach (T item in list1)
            {
                isFound = false;
                for (int i = 0; i < list2.Count; i++)
                {
                    if (item.Equals(list2[i]))
                    {
                        isFound = true;
                    }
                }
                if (!isFound)
                {
                    subtractedList.Add(item);
                }
            }
            return(subtractedList);
        }