Exemple #1
0
        public static CustomClassList <T> operator -(CustomClassList <T> item1, CustomClassList <T> item2)
        {
            CustomClassList <T> resultList = new CustomClassList <T>();

            for (int i = 0; i < item1.count; i++)
            {
                for (int j = 0; j < item2.count; j++)
                {
                    dynamic x = item1[i];
                    dynamic y = item2[j];
                    if (x == y)
                    {
                        // do nothing
                        break;
                    }
                    else if (j < item2.count - 1)
                    {
                        // do nothing
                        continue;
                    }
                    else
                    {
                        resultList.Add(item1[i]);
                        break;
                    }
                }
            }
            return(resultList);
        }
Exemple #2
0
        public static CustomClassList <T> operator +(CustomClassList <T> item1, CustomClassList <T> item2)
        {
            CustomClassList <T> resultList = new CustomClassList <T>();

            for (int i = 0; i < item1.count; i++)
            {
                resultList.Add(item1[i]);
            }
            for (int i = 0; i < item2.count; i++)
            {
                resultList.Add(item2[i]);
            }
            return(resultList);
        }
Exemple #3
0
        public CustomClassList <T> Zip(CustomClassList <T> item)
        {
            CustomClassList <T> resultList = new CustomClassList <T>();
            int  numberToLoop;
            bool areListsEqual;
            int  i;

            if (count > item.count)
            {
                numberToLoop  = item.count;
                areListsEqual = false;
            }
            else if (count < item.count)
            {
                numberToLoop  = count;
                areListsEqual = false;
            }
            else
            {
                numberToLoop  = count;
                areListsEqual = true;
            }

            for (i = 0; i < numberToLoop; i++)
            {
                resultList.Add(customList[i]);
                resultList.Add(item[i]);
            }
            if (!areListsEqual)
            {
                if (count > item.count)
                {
                    for (int j = i; j < count; j++)
                    {
                        resultList.Add(customList[j]);
                    }
                }
                else
                {
                    for (int j = i; j < item.count; j++)
                    {
                        resultList.Add(item[j]);
                    }
                }
            }
            return(resultList);
        }