共用方式為


HttpContentHeaderCollection.ContentLanguage 屬性

定義

取得 物件的 HttpLanguageHeaderValueCollection ,這些物件代表 HTTP 內容上 HTTP Content-Language 標頭的值。

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

屬性值

物件的集合,表示 HTTP 內容上 HTTP Content-Language 標頭的值。 空集合表示標頭不存在

備註

下列範例程式碼示範使用HttpContentHeaderCollection物件上的 ContentLanguage 屬性,取得或設定 HTTP 內容上Content-Language標頭值的方法。

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

適用於

另請參閱