Mega Code Archive

 
Categories / C# / Data Types
 

Decimal ToInt16

using System; class MainClass {     public static void DecimalToU_Int16( decimal argument )     {         object Int16Value = null;         object UInt16Value = null;         try         {             Int16Value = decimal.ToInt16( argument );         }         catch( Exception ex )         {             Int16Value = null;         }         try         {             UInt16Value = decimal.ToUInt16( argument );         }         catch( Exception ex )         {             UInt16Value = null;         }         Console.WriteLine( Int16Value);         Console.WriteLine( UInt16Value );     }     public static void Main( )     {         DecimalToU_Int16( 123M );     } }