Use 'is' for int value type : Integer Family : Data Type C# Examples


C# Examples » Data Type » Integer Family »

 

Use 'is' for int value type









    
using  System;

public  class  MainClass
{
        static  void  Main()  {
                int  j  =  123;
                object  boxed  =  j;
                object  obj  =  new  Object();

                Console.WriteLine(  "boxed  {0}  int",  boxed  is  int  ?  "is"  :  "isnot"  );
                Console.WriteLine(  "obj  {0}  int",  obj  is  int  ?  "is"  :  "isnot"  );
                Console.WriteLine(  "boxed  {0}  System.ValueType",  boxed  is  ValueType  ?  "is"  :  "isnot"  );

        }
}
    
   
  
   



Output

boxed is int
obj isnot int
boxed is System.ValueType


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Integer Family