public static BigInteger CastBigInteger(object sourceObj) { switch (sourceObj) { case null: throw new ArgumentException(); case string stringValue: try { return(SimpleTypeParserFunctions.ParseBigInteger(stringValue)); } catch (FormatException) { return(default(BigInteger)); } default: return(sourceObj.AsBigInteger()); } }
/// <summary> /// Casts the object to the System.Numerics.BigInteger /// </summary> /// <param name="sourceObj">The source object</param> public static BigInteger?CastNullableBigInteger(object sourceObj) { switch (sourceObj) { case null: return(null); case string stringValue: try { return(SimpleTypeParserFunctions.ParseBigInteger(stringValue)); } catch (FormatException) { return(default(BigInteger?)); } default: return(sourceObj.AsBigInteger()); } }