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


C# Examples » Data Type » Data Type Cast »

 

Cast a uint into a short, data lost









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



Output

s after assigning 64000: -1536 -- data lost.


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Data Type
» Data Type Cast