Skip to content

Commit

Permalink
Address peer review
Browse files Browse the repository at this point in the history
  • Loading branch information
jhonabreul committed Sep 5, 2024
1 parent 3327576 commit cfd3b2f
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions Common/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1582,7 +1582,7 @@ public static List<string> ToCsvData(this string str, int size = 4, char delimit
public static bool TryGetFromCsv(this string csvLine, int index, out ReadOnlySpan<char> result)
{
result = ReadOnlySpan<char>.Empty;
if (csvLine.IsNullOrEmpty() || index < 0)
if (string.IsNullOrEmpty(csvLine) || index < 0)
{
return false;
}
Expand Down Expand Up @@ -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);
}

/// <summary>
Expand Down

0 comments on commit cfd3b2f

Please sign in to comment.