Exemple #1
0
        public static NewCustomList <T> Zip(NewCustomList <T> list1, NewCustomList <T> list2)
        {
            NewCustomList <T> newlist = new NewCustomList <T>();

            int Count = list1.Count < list2.Count ? list1.Count : list2.Count;

            for (int i = 0; i < Count; i++)
            {
                newlist.Add(list1[i]);
                newlist.Add(list2[i]);
            }
            return(newlist);
        }
        static void Main(string[] args)
        {
            NewCustomList <int> list = new NewCustomList <int>();

            list.Add(2);
            list.Add(5);
            list.Add(3);

            foreach (int x in list)
            {
                Console.WriteLine(x);
            }
        }
Exemple #3
0
        ///overloading + operator
        //overloading - operator
        //method zip
        //txt documantation for - operator
        //iterable
        //
        public static NewCustomList <T> operator +(NewCustomList <T> list1, NewCustomList <T> list2)
        {
            NewCustomList <T> newlist = new NewCustomList <T>();

            foreach (T item in list1)
            {
                newlist.Add(item);
            }
            foreach (T item in list2)
            {
                newlist.Add(item);
            }
            return(newlist);
        }