decimal decimalVal;
Decimal.TryParse(\"123-\", out decimalVal);
Console.WriteLine(decimalVal); // -123
Why do \"123-\" string parsed this way?
The Decimal.TryParse Method parses the input with NumberStyles.Number by default. NumberStyles.Number includes NumberStyles.AllowTrailingSign.
Decimal.TryParse Method (String, Decimal)
[...]
Parameter s is interpreted using the NumberStyles.Number style.
[...]
Number Indicates that the AllowLeadingWhite, AllowTrailingWhite, AllowLeadingSign, AllowTrailingSign, AllowDecimalPoint, and AllowThousands styles are used. This is a composite number style.
AllowTrailingSign Indicates that the numeric string can have a trailing sign. Valid trailing sign characters are determined by the NumberFormatInfo.PositiveSign and NumberFormatInfo.NegativeSign properties.