Exemplo n.º 1
0
 static bool ColorCmp(CarBrand exemple, string color)
 {
     if (exemple.Color == color)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            CarBrand model = new CarBrand();

            model = new CarBrand("Bmw", 2010, "Germany", 3, "x5", "hatchback");
            model.setValues("black", 15000);


            model.Notify += DisplayMessage;
            model.PriceIncrease(1000);
            model.PriceReduction(5000);
            model.PriceReduction(17000);

            Console.WriteLine("\n\n");

            CarBrandColor color1 = (CarBrand exemple, string color) => ColorCmp(model, "green");

            if (color1(model, "green"))
            {
                Console.WriteLine("машина зеленого цвета");
            }
            else
            {
                Console.WriteLine("машина другого цвета");
            }
            Console.WriteLine("\n\n");

            model.GetInfo();

            CarName carName;

            carName = SetCarName;
            // ковар.
            Car model2 = carName("Ford");

            Console.WriteLine(model2.Name);

            //контр.
            CBName   cbname = GetCarName;
            CarBrand model3 = new CarBrand {
                Name = "Ferrari"
            };

            cbname(model3);
        }