Exemplo n.º 1
0
        // The definition of the extension method for the class OrderErrorCollection.
        public static void PrintOrderErrors(this OrderErrorCollection orderErrorCollection)
        {
            Console.WriteLine();

            foreach (OrderError orderError in orderErrorCollection)
            {
                Console.WriteLine(orderError.ErrorText);
            }
        }
Exemplo n.º 2
0
        // Overload the operator + for two OrderErrorCollection objects.
        public static OrderErrorCollection operator +(OrderErrorCollection orderErrorCollection1, OrderErrorCollection orderErrorCollection2)
        {
            OrderErrorCollection orderErrorCollection = new OrderErrorCollection();

            if (null != orderErrorCollection1)
            {
                foreach (OrderError orderError in orderErrorCollection1)
                {
                    orderErrorCollection.Add(orderError);
                }
            }

            if (null != orderErrorCollection2)
            {
                foreach (OrderError orderError in orderErrorCollection2)
                {
                    orderErrorCollection.Add(orderError);
                }
            }

            return(orderErrorCollection);
        }