Dela via


HttpLanguageRangeWithQualityHeaderValue Class

Definition

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

public ref class HttpLanguageRangeWithQualityHeaderValue sealed : IStringable
/// [Windows.Foundation.Metadata.Activatable(Windows.Web.Http.Headers.IHttpLanguageRangeWithQualityHeaderValueFactory, 65536, Windows.Foundation.UniversalApiContract)]
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class HttpLanguageRangeWithQualityHeaderValue final : IStringable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
/// [Windows.Foundation.Metadata.Activatable(Windows.Web.Http.Headers.IHttpLanguageRangeWithQualityHeaderValueFactory, 65536, "Windows.Foundation.UniversalApiContract")]
class HttpLanguageRangeWithQualityHeaderValue final : IStringable
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Web.Http.Headers.IHttpLanguageRangeWithQualityHeaderValueFactory), 65536, typeof(Windows.Foundation.UniversalApiContract))]
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class HttpLanguageRangeWithQualityHeaderValue : IStringable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
[Windows.Foundation.Metadata.Activatable(typeof(Windows.Web.Http.Headers.IHttpLanguageRangeWithQualityHeaderValueFactory), 65536, "Windows.Foundation.UniversalApiContract")]
public sealed class HttpLanguageRangeWithQualityHeaderValue : IStringable
function HttpLanguageRangeWithQualityHeaderValue(languageRange, quality)
Public NotInheritable Class HttpLanguageRangeWithQualityHeaderValue
Implements IStringable
Inheritance
Object Platform::Object IInspectable HttpLanguageRangeWithQualityHeaderValue
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

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, Double)

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

HttpLanguageRangeWithQualityHeaderValue(String)

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

Properties

LanguageRange

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

Quality

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

Methods

Parse(String)

Converts a string to an HttpLanguageRangeWithQualityHeaderValue instance.

ToString()

Returns a string that represents the current HttpLanguageRangeWithQualityHeaderValue object.

TryParse(String, HttpLanguageRangeWithQualityHeaderValue)

Determines whether a string is valid HttpLanguageRangeWithQualityHeaderValue information.

Applies to

See also