HttpRequestHeaderCollection.From 屬性

定義

取得或設定 String ,表示 HTTP 要求上 From HTTP 標頭的值。

public:
 property Platform::String ^ From { Platform::String ^ get(); void set(Platform::String ^ value); };
winrt::hstring From();

void From(winrt::hstring value);
public string From { get; set; }
var string = httpRequestHeaderCollection.from;
httpRequestHeaderCollection.from = string;
Public Property From As String

屬性值

String

Platform::String

winrt::hstring

HTTP 要求上 From HTTP 標頭的值。 空字串表示標頭不存在。

備註

下列範例程式碼示範使用HttpRequestHeaderCollection物件上的 From 屬性,在HttpRequestMessage物件上設定From標頭的方法。

public void DemonstrateHeaderRequestFrom() {
    var request = new HttpRequestMessage();

    // Set the header with a string.
    request.Headers.From = "person@example.com";

    // Get the strong type out
    System.Diagnostics.Debug.WriteLine("From value: {0}", request.Headers.From);
}

適用於

另請參閱