예제 #1
0
        static void Main(string[] args)
        {
            ExDeviderV2.Ex1();
            //using Dictionary;
            MyDictionary <dynamic, string> dictionary = new MyDictionary <dynamic, string>();

            dictionary.Add("abc1", "абв1");
            dictionary.Add("abc2", "абв2");
            dictionary.Add("abc3", "абв3");
            dictionary.Add("abc4", "абв4");
            dictionary.Add("abc5", "абв5");
            dictionary.Add("abc6", "абв6");
            dictionary.Add("abc7", "абв7");



            foreach (string item in dictionary)
            {
                Console.WriteLine(item);
            }



            ExDeviderV2.Ex2();
        }
예제 #2
0
        public static void Show()
        {
            ExDeviderV2.Ex2();

            Block a = new Block(0, 1, 2, 3);
            Block b = new Block(4, 5, 6, 7);
            Block c = new Block(0, 1, 2, 3);


            Console.WriteLine("a == b : {0}", a.Equals(b));
            Console.WriteLine("a == c : {0}", a.Equals(c));
        }
예제 #3
0
        public static void Show()
        {
            ExDeviderV2.Ex2();

            var listAuto = new List <Auto>
            {
                new Auto("Fiat", "Bravo", 2005, "red"),
                new Auto("Mersedes", "E", 2010, "black"),
                new Auto("Skoda", "Fabia", 2009, "yellow"),
                new Auto("Mersedes", "A", 2009, "grey")
            };

            foreach (var auto in listAuto)
            {
                Console.WriteLine(auto.ToString());
            }

            ExDeviderV2.Line();

            var listCustomer = new List <Customer>
            {
                new Customer("Petrov", "Mersedes", "0509864578"),
                new Customer("Ivanov", "Fiat", "0509876545"),
                new Customer("Vasiliev", "Skoda", "0504789863")
            };

            foreach (var customer in listCustomer)
            {
                Console.WriteLine(customer.ToString());
            }

            ExDeviderV2.DoubleLine();


            var query =
                from customer in listCustomer
                join auto in listAuto
                on customer.Model equals auto.Mark
                select new
            {
                Name  = customer.Name,
                Model = customer.Model,
                Tel   = customer.Tel,
                Mark  = auto.Model,
                Year  = auto.Year,
                Color = auto.Colour
            };

            foreach (var item in query)
            {
                Console.WriteLine($"{item.Name} {item.Tel} {item.Model} {item.Mark} {item.Color} {item.Year}");
            }
        }