Mega Code Archive

 
Categories / C# Tutorial / Data Type
 

Conversions of numeric types

using System; class MainClass {     public static void Main()     {         checked         {             uint value1 = 312;             byte value2 = (byte) value1;             Console.WriteLine("Value: {0}", value2);         }     } } Unhandled Exception: System.OverflowException: Arithmetic operation resulted in an overflow. at MainClass.Main()