Skip to content

Commit

Permalink
remove duplicate dictionary lookup (#1361)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp authored Feb 16, 2024
1 parent 743729c commit 6efb990
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ public override string Convert(long input)

private static string GetOrdinalUnit(int number, bool useExceptions)
{
if (useExceptions && OrdinalExceptions.ContainsKey(number))
if (useExceptions && OrdinalExceptions.TryGetValue(number, out var unit))
{
return OrdinalExceptions[number];
return unit;
}

return OrdinalUnitsMap[number];
Expand Down

0 comments on commit 6efb990

Please sign in to comment.