System.Net.Http.WinHttpResponseParser.GetReasonPhrase C# (CSharp) Method

GetReasonPhrase() private static method

private static GetReasonPhrase ( HttpStatusCode statusCode, char buffer, int bufferLength ) : string
statusCode HttpStatusCode
buffer char
bufferLength int
return string
        private static string GetReasonPhrase(HttpStatusCode statusCode, char[] buffer, int bufferLength)
        {
            CharArrayHelpers.DebugAssertArrayInputs(buffer, 0, bufferLength);
            Debug.Assert(bufferLength > 0);

            // If it's a known reason phrase, use the known reason phrase instead of allocating a new string.

            string knownReasonPhrase = HttpStatusDescription.Get(statusCode);

            return (knownReasonPhrase != null && CharArrayHelpers.EqualsOrdinal(knownReasonPhrase, buffer, 0, bufferLength)) ?
                knownReasonPhrase :
                new string(buffer, 0, bufferLength);
        }