Skip to main content
HttpContentHeaderCollection.ContentLanguage | contentLanguage property

Applies to Windows and Windows Phone

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

Syntax


var contentLanguage = httpContentHeaderCollection.contentLanguage;

public HttpLanguageHeaderValueCollection ContentLanguage { get; }

Public ReadOnly Property ContentLanguage As HttpLanguageHeaderValueCollection

public:
property HttpLanguageHeaderValueCollection^ ContentLanguage { 
   HttpLanguageHeaderValueCollection^ get();
}

Property value

Type: HttpLanguageHeaderValueCollection

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());
    }

Requirements

Minimum supported client

Windows 8.1

Minimum supported server

Windows Server 2012 R2

Minimum supported phone

Windows Phone 8.1 [Windows Phone Silverlight 8.1 and Windows Runtime apps]

Namespace

Windows.Web.Http.Headers
Windows::Web::Http::Headers [C++]

Metadata

Windows.winmd

See also

HttpContentHeaderCollection
HttpLanguageHeaderValueCollection