HttpLanguageRangeWithQualityHeaderValue HttpLanguageRangeWithQualityHeaderValue HttpLanguageRangeWithQualityHeaderValue HttpLanguageRangeWithQualityHeaderValue Class

Represents accept language information used in the Accept-Language HTTP header on an HTTP request.

Syntax

Declaration

public sealed class HttpLanguageRangeWithQualityHeaderValuepublic sealed class HttpLanguageRangeWithQualityHeaderValuePublic NotInheritable Class HttpLanguageRangeWithQualityHeaderValue

Remarks

The HttpLanguageRangeWithQualityHeaderValue class represents accept language information used in the Accept-Language HTTP header on an HTTP request.

The Accept-Language header can be used by clients to indicate the set of natural languages that are preferred in the response. A language range is defined in IETF RFC 4647. It is a language tag, or partial language tag, indicating a language, or range of languages. For example en-us would be American English, and en-gb would be British English. While en is a language range, meaning any variation of English.

Each language-range can be given an associated quality value representing an estimate of the user's preference for the languages specified by that range. The quality must be in the range 0.0 to 1.0.

Some recipients treat the order in which language tags are listed as an indication of descending priority, particularly for tags that are assigned equal quality values (no value is the same as q=1). However, this behavior cannot be relied upon. For consistency and to maximize interoperability, many user agents assign each language tag a unique quality value while also listing them in order of decreasing quality.

The AcceptLanguage property on the HttpRequestHeaderCollection returns an HttpLanguageRangeWithQualityHeaderValueCollection that contains HttpLanguageRangeWithQualityHeaderValue objects.

Constructors summary

Initializes a new instance of the HttpLanguageRangeWithQualityHeaderValue class with language-range information.

Initializes a new instance of the HttpLanguageRangeWithQualityHeaderValue class with language-range and quality information.

Properties summary

Gets the value of the language-range information from the HttpLanguageRangeWithQualityHeaderValue used in the Accept-Language HTTP header.

Gets the value of the qvalue or quality factor from the HttpLanguageRangeWithQualityHeaderValue used in the Accept-Language HTTP header.

Methods summary

Converts a string to an HttpLanguageRangeWithQualityHeaderValue instance.

Returns a string that represents the current HttpLanguageRangeWithQualityHeaderValue object.

Determines whether a string is valid HttpLanguageRangeWithQualityHeaderValue information.

Constructors

  • HttpLanguageRangeWithQualityHeaderValue(System.String)
    HttpLanguageRangeWithQualityHeaderValue(System.String)
    HttpLanguageRangeWithQualityHeaderValue(System.String)
    HttpLanguageRangeWithQualityHeaderValue(System.String)

    Initializes a new instance of the HttpLanguageRangeWithQualityHeaderValue class with language-range information.

    public HttpLanguageRangeWithQualityHeaderValue(System.String)public HttpLanguageRangeWithQualityHeaderValue(System.String)Public Function HttpLanguageRangeWithQualityHeaderValue(System.String) As

    Parameters

    • languageRange
      System.String
      System.String
      System.String
      System.String

      The value of the language-range information used in the Accept-Language HTTP header.

  • HttpLanguageRangeWithQualityHeaderValue(System.String,System.Double)
    HttpLanguageRangeWithQualityHeaderValue(System.String,System.Double)
    HttpLanguageRangeWithQualityHeaderValue(System.String,System.Double)
    HttpLanguageRangeWithQualityHeaderValue(System.String,System.Double)

    Initializes a new instance of the HttpLanguageRangeWithQualityHeaderValue class with language-range and quality information.

    public HttpLanguageRangeWithQualityHeaderValue(System.String,System.Double)public HttpLanguageRangeWithQualityHeaderValue(System.String,System.Double)Public Function HttpLanguageRangeWithQualityHeaderValue(System.String,System.Double) As

    Parameters

    • languageRange
      System.String
      System.String
      System.String
      System.String

      The value of the language-range information used in the Accept-Language HTTP header.

    • quality
      System.Double
      System.Double
      System.Double
      System.Double

      The value of the qvalue or quality factor used in the Accept-Language HTTP header.

Properties

  • LanguageRange
    LanguageRange
    LanguageRange
    LanguageRange

    Gets the value of the language-range information from the HttpLanguageRangeWithQualityHeaderValue used in the Accept-Language HTTP header.

    public string LanguageRange { get; }public string LanguageRange { get; }Public ReadOnly Property LanguageRange As string

    Property Value

    • string
      string
      string
      string

      The value of the language-range information.

    Remarks

    The Accept-Language header can be used by clients to indicate the set of natural languages that are preferred in the response. A language range is defined in IETF RFC 4647. It is a language tag, or partial language tag, indicating a language, or range of languages. For example en-us would be American English, and en-gb would be British English. While en is a language range, meaning any variation of English.

  • Quality
    Quality
    Quality
    Quality

    Gets the value of the qvalue or quality factor from the HttpLanguageRangeWithQualityHeaderValue used in the Accept-Language HTTP header.

    public IReference<double> Quality { get; }public IReference<double> Quality { get; }Public ReadOnly Property Quality As IReference<double>

    Property Value

    • The value of the qvalue or quality factor.

    Remarks

    Each language-range can be given an associated quality value representing an estimate of the user's preference for the languages specified by that range. The quality must be in the range 0.0 to 1.0. No value for the Quality property is the same as q=1.

Methods

Device family

Windows 10 (introduced v10.0.10240.0)

API contract

Windows.Foundation.UniversalApiContract (introduced v1)

Attributes

Windows.Foundation.Metadata.ContractVersionAttribute
Windows.Foundation.Metadata.DualApiPartitionAttribute
Windows.Foundation.Metadata.MarshalingBehaviorAttribute
Windows.Foundation.Metadata.ActivatableAttribute
Windows.Foundation.Metadata.StaticAttribute
Windows.Foundation.Metadata.ThreadingAttribute

Details

Assembly

Windows.Web.Http.Headers.dll