Use is in Console.WriteLine : Is : Operator C# Examples


C# Examples » Operator » Is »

 

Use is in Console.WriteLine









    
using  System;

public  class  MainClass
{
        static  void  Main()  {
                String  derivedObj  =  "Dummy";
                Object  baseObj1  =  new  Object();
                Object  baseObj2  =  derivedObj;

                Console.WriteLine(  "baseObj2  {0}  String",  baseObj2  is  String  ?  "is"  :  "isnot"  );
                Console.WriteLine(  "baseObj1  {0}  String",  baseObj1  is  String  ?  "is"  :  "isnot"  );
                Console.WriteLine(  "derivedObj  {0}  Object",  derivedObj  is  Object  ?  "is"  :  "isnot"  );

        }
}
    
   
  
   



Output

baseObj2 is String
baseObj1 isnot String
derivedObj is Object


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Operator
» Is