Dela via


HttpContentHeaderCollection.LastModified Property

Definition

Gets or sets the DateTime object that represents the value of an HTTP Last-Modified header on the HTTP content.

public:
 property IReference<DateTime> ^ LastModified { IReference<DateTime> ^ get(); void set(IReference<DateTime> ^ value); };
IReference<DateTime> LastModified();

void LastModified(IReference<DateTime> value);
public System.Nullable<System.DateTimeOffset> LastModified { get; set; }
var iReference = httpContentHeaderCollection.lastModified;
httpContentHeaderCollection.lastModified = iReference;
Public Property LastModified As Nullable(Of DateTimeOffset)

Property Value

The object that represents the value of an HTTP Last-Modified header on the HTTP content. A null value means that the header is absent.

Remarks

The LastModified property represents the Last-Modified header on HTTP content. The Last-Modified header is the date and time that the HTTP content was last modified.

Javascript and .NET languages do not use the DateTime object directly. In Javascript a DateTime is projected as a object, and in .NET it is projected as a System.DateTimeOffset. Each language transparently handles the conversion to the granularity and date ranges for the respective language.

In C++, a value has the same granularity as a and supports the date ranges required by Javascript and .NET.

For more detailed information, see the Windows.Foundation.DateTime structure.

The following sample code shows a method to get or set the Expires header value on HTTP content using the LastModified property on the HttpContentHeaderCollection object.

// Last-Modified header
// nullable DateTimeOffset
//
void DemoLastModified(IHttpContent content) {
    var h = content.Headers;
    h.LastModified = DateTimeOffset.Now;

    var header = h.LastModified;
    uiLog.Text += "\nLAST MODIFIED HEADER\n";
    uiLog.Text += String.Format("LastModified: {0}\n", header.ToString());
}

Applies to

See also