diff --git a/Common/Extensions.cs b/Common/Extensions.cs index 8f4f60c7cffc..911a8bc45c2d 100644 --- a/Common/Extensions.cs +++ b/Common/Extensions.cs @@ -1582,7 +1582,7 @@ public static List ToCsvData(this string str, int size = 4, char delimit public static bool TryGetFromCsv(this string csvLine, int index, out ReadOnlySpan result) { result = ReadOnlySpan.Empty; - if (csvLine.IsNullOrEmpty() || index < 0) + if (string.IsNullOrEmpty(csvLine) || index < 0) { return false; } @@ -1624,15 +1624,7 @@ public static bool TryGetDecimalFromCsv(this string csvLine, int index, out deci return false; } - try - { - value = decimal.Parse(csvValue, NumberStyles.Any, CultureInfo.InvariantCulture); - return true; - } - catch (FormatException) - { - return false; - } + return decimal.TryParse(csvValue, NumberStyles.Any, CultureInfo.InvariantCulture, out value); } ///