I have no idea why this is not working:
string s = "12,00 €";
var germanCulture = CultureInfo.CreateSpecificCulture("de-DE");
decimal d;
if (decimal.TryParse(s, NumberStyles.AllowCurrencySymbol, germanCulture, out d))
{
// i want to get to this point
Console.WriteLine("Decimal value: {0}", d);
}
Use NumberStyles.Currency
instead of NumberStyles.AllowCurrencySymbol
if (decimal.TryParse(s, NumberStyles.Currency, germanCulture, out d))
and the output for you code would be:
Decimal value: 12.00
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With