I am writing a custom string for a decimal validator that should use Decimal.TryParse, which ignores the culture (that is, it doesn't matter if the input contains "." Or "," as a decimal point separator). This is the suggested method:
public static bool TryParse( string s, NumberStyles style, IFormatProvider provider, out decimal result )
I can’t figure out what to use as the third parameter. The examples I saw are as follows:
culture = CultureInfo.CreateSpecificCulture("en-GB"); Decimal.TryParse(value, style, culture, out number)
to create a specific culture. CultureInfo does not have a CreateInvariantCulture method and CultureInfo.InvariantCulture is not a required type. What is the correct use?
decimal c # cultureinfo tryparse
Shaggydog Apr 17 '14 at 11:03 2014-04-17 11:03
source share