System.Net.Http.Headers.ViaHeaderValue.CheckReceivedBy C# (CSharp) Méthode

CheckReceivedBy() private static méthode

private static CheckReceivedBy ( string receivedBy ) : void
receivedBy string
Résultat void
        private static void CheckReceivedBy(string receivedBy)
        {
            if (string.IsNullOrEmpty(receivedBy))
            {
                throw new ArgumentException(SR.net_http_argument_empty_string, nameof(receivedBy));
            }

            // 'receivedBy' can either be a host or a token. Since a token is a valid host, we only verify if the value
            // is a valid host.
            string host = null;
            if (HttpRuleParser.GetHostLength(receivedBy, 0, true, out host) != receivedBy.Length)
            {
                throw new FormatException(string.Format(System.Globalization.CultureInfo.InvariantCulture, SR.net_http_headers_invalid_value, receivedBy));
            }
        }
    }