コード例 #1
0
        static void Main(string[] args)
        {
            ICar[] cars =
            {
                new M3      {
                    Color = Color.Silver
                },
                new Hooptie {
                    Color = Color.Black
                },
            };

            foreach (ICar car in cars)
            {
                PrintInfoCar(car);
                car.CarStopped += OnCarStopped;
                car.Star();
                car.PressAcelerator(2);
                car.PressAcelerator(10);
                car.PressBreak();
                car.PressAcelerator(20);
                car.ChangeMarche();
            }
            ;

            QuitTracker bob = new QuitTracker {
                Name = "Bob"
            };
            QuitTracker sandy = new QuitTracker {
                Name = "Sandy"
            };
            KeystrokeHandler keystrokehandler = new KeystrokeHandler();

            keystrokehandler.OnKey      += GotKey;
            keystrokehandler.OnQuitting += bob.QuitHandler;
            keystrokehandler.OnQuitting += sandy.QuitHandler;
            keystrokehandler.OnQuitting += OnQuit;
            keystrokehandler.Run();

            object carM3 = new M3();
            Type   type  = carM3.GetType();

            Console.WriteLine(type.Assembly.GetName().Version);
            Console.WriteLine(carM3);

            object[] objects =
            {
                new M3(),
                new Hooptie(),
            };

            foreach (object obj in objects)
            {
                Console.WriteLine(obj);
                Is(obj);
                As(obj);
                Cast(obj);
                Console.WriteLine("-------------    ");
            }
        }
コード例 #2
0
        static void Main(string[] args)
        {
            object car  = new M3();
            Type   type = car.GetType();

            Console.WriteLine(type.Assembly.GetName().Version);
            Console.WriteLine(car);
        }