METHOD

Decimal.TryParse with provider

Attempts numeric conversion according to the selected styles and provider; returns success separately.

Formal Syntax & Structure

csharp syntaxcsharp
decimal.TryParse(text, styles, provider, out result)

Working Example

Example Snippetcsharp
bool ok = decimal.TryParse("12.5", System.Globalization.NumberStyles.AllowDecimalPoint, System.Globalization.CultureInfo.InvariantCulture, out decimal value);
C# & .NET Reference