Share via


HttpContentHeaderCollection.ContentLanguage Property

Definition

Gets the HttpLanguageHeaderValueCollection of objects that represent the value of an HTTP Content-Language header on the HTTP content.

public:
 property HttpLanguageHeaderValueCollection ^ ContentLanguage { HttpLanguageHeaderValueCollection ^ get(); };
HttpLanguageHeaderValueCollection ContentLanguage();
public HttpLanguageHeaderValueCollection ContentLanguage { get; }
var httpLanguageHeaderValueCollection = httpContentHeaderCollection.contentLanguage;
Public ReadOnly Property ContentLanguage As HttpLanguageHeaderValueCollection

Property Value

The collection of objects that represent the value of an HTTP Content-Language header on the HTTP content. An empty collection means that the header is absent

Remarks

The following sample code shows a method to get or set the Content-Language header value on HTTP content using the ContentLanguage property on the HttpContentHeaderCollection object.

// Content-Language header
// HttpLanguageHeaderValueCollection (of Windows.Globalization.Language)
void DemoContentLanguage(IHttpContent content) {
    var h = content.Headers;

    h.ContentLanguage.TryParseAdd("en-us");
    h.ContentLanguage.TryParseAdd("ru-ru, ru-us");
    h.ContentLanguage.Add(new Windows.Globalization.Language("ko-ko"));

    var header = h.ContentLanguage;
    uiLog.Text += "\nCONTENT LANGUAGE HEADER\n";
    foreach (var item in header) {
        uiLog.Text += string.Format("DisplayName: {0} ToString: {1}\n", item.DisplayName, item.ToString());
    }
    uiLog.Text += string.Format("ContentLanguage: ToString: {0}\n\n", header.ToString());
}

Applies to

See also