示例#1
0
        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);
        }
示例#2
0
        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");
        }
示例#3
0
        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);
        }
示例#4
0
        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);
        }
示例#5
0
        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);
        }