Beispiel #1
0
        public static Marbles <T> operator -(Marbles <T> list1, Marbles <T> list2)
        {
            Marbles <T> marblesArray = new Marbles <T>();
            Marbles <T> tempArray    = new Marbles <T>();
            Marbles <T> tempList1    = new Marbles <T>();
            Marbles <T> tempList2    = new Marbles <T>();


            for (int i = 0; i < list1.Count; i++)
            {
                marblesArray.Add(list1[i]);
            }
            for (int i = 0; i < list2.Count; i++)
            {
                marblesArray.Add(list2[i]);
            }

            for (int i = 0; i < list1.Count; i++)
            {
                var valueToCheck1 = list1[i];
                for (int j = 0; j < list2.Count; j++)
                {
                    if (list1[i].Equals(list2[j]))
                    {
                        marblesArray.Remove(list1[i]);
                        break;
                    }
                }
            }
            return(marblesArray);
        }
Beispiel #2
0
        public static Marbles <T> operator +(Marbles <T> list1, Marbles <T> list2)
        {
            Marbles <T> marblesArray = new Marbles <T>();


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

            list.Add(4);
            Console.WriteLine(list[0]);
            Console.ReadLine();
        }