using System;using System.IO;class First {}class Second : First {}class C : First {}class RTTIDemo{ public static void Main() { First a = new First(); Second b = new Second(); if( a is First ) Console.WriteLine ( "a is a First" ); if( b is First) Console.WriteLine( "b is a First because it is deriived from First" ); if(b is Second) Console.WriteLine( "b is Second" ); if(a is object) Console.WriteLine("a is an Object"); C c = new C(); c = a as C; if(c == null) Console.WriteLine( "Cast c = (C) a is not allowed." ); else Console.WriteLine( "Cast c = (C)a is allowed" ); Type t = typeof( StreamReader ); Console.WriteLine( t.FullName ); if ( t.IsClass ) Console.WriteLine( "Is a class" ); if( t.IsAbstract ) Console.WriteLine( "Is abstract." ); else Console.WriteLine( "Is concrete." ); Console.Read(); }}