Cast a uint into a short, no data lost : Data Type Cast : Data Type C# Examples


C# Examples » Data Type » Data Type Cast »

 

Cast a uint into a short, no data lost









    
using  System;  
  
class  Example  {        
    public  static  void  Main()  {        
        uint  u;  
        short  s;  
        
        u  =  32000;  
        s  =  (short)  u;  
        Console.WriteLine("s  after  assigning  32000:  "  +  s  +  
                                            "  --  no  data  lost.");    
    }
}
    
   
  
   



Output

s after assigning 32000: 32000 -- no data lost.


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Data Type Cast