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(); }
public static void Show() { ExDeviderV2.AdditionalEx(); Console.WriteLine(Calculator.Add("1", 2)); Console.WriteLine(Calculator.Div(1, 3)); Console.WriteLine(Calculator.Div(1, 0)); Console.WriteLine(Calculator.Mult(2, 2.5)); Console.WriteLine(Calculator.Sub(2, 10)); }
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)); }
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}"); } }
static void Main(string[] args) { ExDeviderV2.AdditionalEx();//-------------------------------------------------------------------------------------------------------------------------- Point test = new Point(1, 2, 3) + new Point(3, 3, 3); Console.WriteLine(test.X + " " + test.Y + " " + test.Z); //-------------------------------------------------------------------------------------------------------------------------- Ex2.Ex2Pr.Show(); Ex3.Ex3Pr.Show(); Ex4.Ex4Pr.Show(); }
public static void Show() { ExDeviderV2.Ex4(); MyDate date1 = new MyDate(DateTime.Now); Console.WriteLine(date1.ToString()); MyDate date2 = new MyDate(new DateTime(2022, 12, 4)); Console.WriteLine(date2.ToString()); Console.WriteLine("date1 - date2 = " + ((date1 - date2))); int days = 20; Console.WriteLine($"date + {days} days = {date1 + days}"); }
static public void Show() { ExDeviderV2.Ex3(); House original = new House(); House clone = original.Clone() as House; Console.WriteLine("Первая проверка"); Console.WriteLine(original); Console.WriteLine(clone); // Изменяем clone.x (при этом original.x не изменится) clone.Room = "your room"; clone.Toilet = "your toilet"; // Проверка. Console.WriteLine("Вторая проверка после изменения"); Console.WriteLine(original); Console.WriteLine(clone); }
public static void Show() { ExDeviderV2.Ex3(); dynamic dict = new Dictionary <dynamic, dynamic> { { new { Key = "table" }, new { Value = "стол" } }, { new { Key = "apple" }, new { Value = "яблоко" } }, { new { Key = "pen" }, new { Value = "ручка" } }, { new { Key = "pencil" }, new { Value = "карандаш" } }, { new { Key = "task" }, new { Value = "задание" } }, { new { Key = "key" }, new { Value = "ключ" } }, { new { Key = "customer" }, new { Value = "покупатель" } }, { new { Key = "ship" }, new { Value = "корабль" } }, { new { Key = "car" }, new { Value = "машина" } }, { new { Key = "cap" }, new { Value = "чашка" } }, { "-------------", "----------" }, { "table2", "стол2" }, { "apple2", "яблоко2" }, { "pen2", "ручка2" }, { "penci2l", "карандаш2" }, { "task2", "задание2" }, { "key2", "ключ2" }, { "customer2", "покупатель2" }, { "ship2", "корабль2" }, { "car2", "машина2" }, { "cap2", "чашка2" } }; foreach (var item in dict) { Console.WriteLine($"{item.Key}-{item.Value}"); } }