ThisToThat/ThisToThat/ToDecimalExtensions.cs
/// <summary>
/// Converts and returns this string's value as Decimal.
/// The default value passed in is returned if the string does not successfully parse to Decimal.
/// </summary>
/// <returns>This string converted to Decimal, or the default value if conversion unsuccessful.</returns>
Converts and returns this string's value as Decimal.
The default value passed in is returned if the string does not successfully parse to Decimal.
Converts and returns this string ' s value as Decimal . The default value passed in is returned if the string does not successfully parse to Decimal .
public static Decimal ToDecimalOrDefault(this string strThisString, Decimal decimalDefault = default(Decimal))
        {
            Decimal decimalReturn;
            return Decimal.TryParse(strThisString, out decimalReturn) ? decimalReturn : decimalDefault;
        }
public static Decimal ToDecimalOrDefault ( this string strThisString , Decimal decimalDefault = default ( Decimal ) ) { Decimal decimalReturn ; return Decimal . TryParse ( strThisString , out decimalReturn ) ? decimalReturn : decimalDefault ; }
Converts and returns this string's value as Decimal.
Converts and returns this string ' s value as Decimal .
This string converted to Decimal, or the default value if conversion unsuccessful.
This string converted to Decimal or the default value if conversion unsuccessful .
string
this
decimalDefault
Decimal