Get Type Code after casting : Data Type Cast : Data Type C# Examples


C# Examples » Data Type » Data Type Cast »

 

Get Type Code after casting









    
using  System;

using  System.Globalization;

class  MainClass
{
    static  void  Main(string[]  args)
    {            
        //  Get  the  type  code  of  C#  int.
        int  theInt  =  65;
        Console.WriteLine("Type  code  of  int  is:  {0}",  theInt.GetTypeCode());

        Console.WriteLine("Casting  System.Int32  to  System.Char");
        char  theChar  =  (char)theInt;    
        Console.WriteLine("Type  code  int  converted  to  char  is:  {0}",  theChar.GetTypeCode());
        Console.WriteLine("Value  of  converted  char:  {0}",  theChar);
        
    }
}
    
   
  
   



Output

Type code of int is: Int32
Casting System.Int32 to System.Char
Type code int converted to char is: Char
Value of converted char: A


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Data Type Cast