HttpLanguageRangeWithQualityHeaderValue HttpLanguageRangeWithQualityHeaderValue HttpLanguageRangeWithQualityHeaderValue HttpLanguageRangeWithQualityHeaderValue Class

Definition

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

public : sealed class HttpLanguageRangeWithQualityHeaderValue : IStringable, IHttpLanguageRangeWithQualityHeaderValuepublic sealed class HttpLanguageRangeWithQualityHeaderValue : IStringable, IHttpLanguageRangeWithQualityHeaderValuePublic NotInheritable Class HttpLanguageRangeWithQualityHeaderValue Implements IStringable, IHttpLanguageRangeWithQualityHeaderValue// You can use this class in JavaScript.
Attributes
Windows 10 requirements
Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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

HttpLanguageRangeWithQualityHeaderValue(String) HttpLanguageRangeWithQualityHeaderValue(String) HttpLanguageRangeWithQualityHeaderValue(String) HttpLanguageRangeWithQualityHeaderValue(String)

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

public : HttpLanguageRangeWithQualityHeaderValue(PlatForm::String languageRange)public HttpLanguageRangeWithQualityHeaderValue(String languageRange)Public Sub New(languageRange As String)// You can use this method in JavaScript.
Parameters
languageRange
PlatForm::String String String String

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

See Also

HttpLanguageRangeWithQualityHeaderValue(String, Double) HttpLanguageRangeWithQualityHeaderValue(String, Double) HttpLanguageRangeWithQualityHeaderValue(String, Double) HttpLanguageRangeWithQualityHeaderValue(String, Double)

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

public : HttpLanguageRangeWithQualityHeaderValue(PlatForm::String languageRange, double quality)public HttpLanguageRangeWithQualityHeaderValue(String languageRange, Double quality)Public Sub New(languageRange As String, quality As Double)// You can use this method in JavaScript.
Parameters
languageRange
PlatForm::String String String String

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

quality
double Double Double Double

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

See Also

Properties

LanguageRange LanguageRange LanguageRange LanguageRange

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

public : PlatForm::String LanguageRange { get; }public string LanguageRange { get; }Public ReadOnly Property LanguageRange As string// You can use this property in JavaScript.
Value
PlatForm::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 Nullable<double> Quality { get; }Public ReadOnly Property Quality As Nullable<double>// You can use this property in JavaScript.
Value
IReference<double> Nullable<double> Nullable<double> Nullable<double>

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

Parse(String) Parse(String) Parse(String) Parse(String)

Converts a string to an HttpLanguageRangeWithQualityHeaderValue instance.

public : static HttpLanguageRangeWithQualityHeaderValue Parse(PlatForm::String input)public static HttpLanguageRangeWithQualityHeaderValue Parse(String input)Public Static Function Parse(input As String) As HttpLanguageRangeWithQualityHeaderValue// You can use this method in JavaScript.
Parameters
input
PlatForm::String String String String

A string that represents the language-range and quality factor information used in the Accept-Encoding HTTP header.

Returns

Remarks

Below is the exception that this function throws.

E_INVALIDARG

The input parameter is null (Nothing in Visual Basic).

The input parameter is not valid language-range and quality factor information.

ToString() ToString() ToString() ToString()

Returns a string that represents the current HttpLanguageRangeWithQualityHeaderValue object.

public : PlatForm::String ToString()public string ToString()Public Function ToString() As string// You can use this method in JavaScript.
Returns
PlatForm::String string string string

A string that represents the current object.

TryParse(String, HttpLanguageRangeWithQualityHeaderValue) TryParse(String, HttpLanguageRangeWithQualityHeaderValue) TryParse(String, HttpLanguageRangeWithQualityHeaderValue) TryParse(String, HttpLanguageRangeWithQualityHeaderValue)

Determines whether a string is valid HttpLanguageRangeWithQualityHeaderValue information.

public : static PlatForm::Boolean TryParse(PlatForm::String input, HttpLanguageRangeWithQualityHeaderValue languageRangeWithQualityHeaderValue)public static bool TryParse(String input, HttpLanguageRangeWithQualityHeaderValue languageRangeWithQualityHeaderValue)Public Static Function TryParse(input As String, languageRangeWithQualityHeaderValue As HttpLanguageRangeWithQualityHeaderValue) As bool// You can use this method in JavaScript.
Parameters
input
PlatForm::String String String String

The string to validate.

Returns
PlatForm::Boolean bool bool bool

true if input is valid HttpLanguageRangeWithQualityHeaderValue information; otherwise, false.