We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 84d4f98 commit 344293dCopy full SHA for 344293d
src/Http/WebUtilities/src/ReasonPhrases.cs
@@ -182,12 +182,13 @@ public static class ReasonPhrases
182
/// <returns>The reason phrase, or <see cref="string.Empty"/> if the status code is unknown.</returns>
183
public static string GetReasonPhrase(int statusCode)
184
{
185
- if (statusCode >= 100 && statusCode < 600)
+ if ((uint)(statusCode - 100) < 500)
186
187
- int i = Math.DivRem(statusCode, 100, out int j);
188
- if (j < HttpReasonPhrases[i].Length)
+ var (i, j) = Math.DivRem((uint)statusCode, 100);
+ string[] phrases = HttpReasonPhrases[i];
189
+ if (j < (uint)phrases.Length)
190
- return HttpReasonPhrases[i][j];
191
+ return phrases[j];
192
}
193
194
return string.Empty;
0 commit comments