Exemple #1
0
        static void Main(string[] args)
        {
            Checker  check = new Checker();
            ClassA   try1  = new ClassA();
            ClassB   try2  = new ClassB();
            ClassC   try3  = new ClassC();
            ClassD   try4  = new ClassD();
            MyStruct try5  = new MyStruct();
            object   try6  = try5;

            Console.WriteLine("Analyzing ClassA type variable:");
            check.Check(try1);

            Console.WriteLine("\nAnalyzing ClassB type variable:");
            check.Check(try2);
            Console.WriteLine("\nAnalyzing ClassC type variable:");
            check.Check(try3);
            Console.WriteLine("\nAnalyzing ClassD type variable:");
            check.Check(try4);
            Console.WriteLine("\nAnalyzing MyStruct type variable:");
            check.Check(try5);
            Console.WriteLine("\nAnalyzing boxed MyStruct type variable:");
            check.Check(try6);
            Console.ReadKey();
        }
Exemple #2
0
 static void Main(string[] args)
 {
     Checker check = new Checker(); 
     ClassA try1 = new ClassA();
     ClassB try2 = new ClassB();
     ClassC try3 = new ClassC();
     ClassD try4 = new ClassD();
     MyStruct try5 = new MyStruct();
     object try6 = try5;
     Console.WriteLine("Analyzing ClassA type variable:");
                       // Анализ переменной типа ClassA 
     check.Check(try1);
     Console.WriteLine("\nAnalyzing ClassB type variable:"); 
                       // Анализ переменной типа ClassB 
     check.Check(try2);
     Console.WriteLine("\nAnalyzing ClassC type variable:");
                       // Анализ переменной типа ClassC 
     check.Check(try3);
     Console.WriteLine("\nAnalyzing ClassD type variable:");
                       // Анализ переменной типа ClassD  
     check.Check(try4);
     Console.WriteLine("\nAnalyzing MyStruct type variable:");
                       // Анализ переменной типа MyStruct  
     check.Check(try5);
     Console.WriteLine("\nAnalyzing boxed MyStruct type variable:"); 
                       // Анализ упакованной 
     check.Check(try6); 
     Console.ReadKey(); 
 }
Exemple #3
0
        static void Main(string[] args)
        {
            Checker  check = new Checker();
            ClassA   try1  = new ClassA();
            ClassB   try2  = new ClassB();
            ClassC   try3  = new ClassC();
            ClassD   try4  = new ClassD();
            MyStruct try5  = new MyStruct();
            //Box the struct value, getting a reference to a new instance of the try5 struct.
            object try6 = try5;

            WriteLine("Analyzing ClassA type variable:");
            check.Check(try1);

            WriteLine("\nAnalyzing ClassB type variable:");
            check.Check(try2);

            WriteLine("\nAnalyzing ClassC type variable:");
            check.Check(try3);

            WriteLine("\nAnalyzing ClassD type variable:");
            check.Check(try4);

            WriteLine("\nAnalyzing MyStruct type variable:");
            check.Check(try5);

            WriteLine("\nAnalyzing boxed MyStruct type variable:");
            check.Check(try6);
            ReadKey();
        }