using System; class DecimalToU_Int32Demo { const string formatter = "{0,17}{1,19}{2,19}"; public static string GetExceptionType( Exception ex ) { string exceptionType = ex.GetType( ).ToString( ); return exceptionType.Substring(exceptionType.LastIndexOf( '.' ) + 1 ); } public static void DecimalToU_Int32( decimal argument ) { object Int32Value; object UInt32Value; try { Int32Value = (int)argument; } catch( Exception ex ) { Int32Value = GetExceptionType( ex ); } try { UInt32Value = (uint)argument; } catch( Exception ex ) { UInt32Value = GetExceptionType( ex ); } Console.WriteLine( formatter, argument, Int32Value, UInt32Value ); } public static void Main( ) { DecimalToU_Int32( 123M ); } }