Пример #1
0
        public static ListB <T> operator +(ListB <T> l1, ListB <T> l2)
        {
            ListB <T> combinedList = new ListB <T>();

            for (int i = 0; i < l1.Count; i++)
            {
                combinedList.Add(l1[i]);
            }

            for (int i = 0; i < l2.Count; i++)
            {
                combinedList.Add(l2[i]);
            }

            return(combinedList);
        }
Пример #2
0
        public static ListB <T> operator -(ListB <T> l1, ListB <T> l2)
        {
            ListB <T> newList = new ListB <T>();

            for (int i = 0; i < l1.Count; i++)
            {
                newList.Add(l1[i]);
            }


            for (int i = 0; i < newList.Count; i++)
            {
                for (int j = 0; j < l2.Count; j++)
                {
                    if (newList[i].Equals(l2[j]))
                    {
                        newList.Remove(l2[j]);
                    }
                }
            }

            return(newList);
        }
Пример #3
0
        //member methods

        public ListB <T> Zip(ListB <T> list)
        {
            ListB <T> temp1 = new ListB <T>();
            ListB <T> temp2 = new ListB <T>();

            for (int i = 0; i < list.Count; i++)
            {
                temp1.Add(list[i]);
            }
            for (int i = 0; i < listArray.Length; i++)
            {
                temp2.Add(listArray[i]);
            }
            ListB <T> zippedList = new ListB <T>();
            int       maxCount;

            if (temp1.Count > temp2.Count)
            {
                maxCount = temp1.Count;
            }
            else
            {
                maxCount = temp2.Count;
            }
            for (int i = 0; i < maxCount; i++)
            {
                if (i < temp2.Count)
                {
                    zippedList.Add(temp2[i]);
                }
                if (i < temp1.Count)
                {
                    zippedList.Add(temp1[i]);
                }
            }
            return(zippedList);
        }