Jaa


HttpDateOrDeltaHeaderValue Class

Definition

Represents the value of the Retry-After HTTP header on an HTTP response.

public ref class HttpDateOrDeltaHeaderValue sealed : IStringable
/// [Windows.Foundation.Metadata.ContractVersion(Windows.Foundation.UniversalApiContract, 65536)]
/// [Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
/// [Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
class HttpDateOrDeltaHeaderValue final : IStringable
[Windows.Foundation.Metadata.ContractVersion(typeof(Windows.Foundation.UniversalApiContract), 65536)]
[Windows.Foundation.Metadata.MarshalingBehavior(Windows.Foundation.Metadata.MarshalingType.Agile)]
[Windows.Foundation.Metadata.Threading(Windows.Foundation.Metadata.ThreadingModel.Both)]
public sealed class HttpDateOrDeltaHeaderValue : IStringable
Public NotInheritable Class HttpDateOrDeltaHeaderValue
Implements IStringable
Inheritance
Object Platform::Object IInspectable HttpDateOrDeltaHeaderValue
Attributes
Implements

Windows requirements

Device family
Windows 10 (introduced in 10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced in v1.0)

Examples

The following sample code shows a method to get and set the Retry-After HTTP header on an HttpResponseMessage object using the properties and methods on the HttpDateOrDeltaHeaderValue class.

using System;
using Windows.Web.Http;
using Windows.Web.Http.Headers;

        public void DemonstrateHeaderResponseRetryAfter() {
            var response = new HttpResponseMessage();

            // Set the header with a strong type.
            HttpDateOrDeltaHeaderValue newvalue;
            bool parseOk = HttpDateOrDeltaHeaderValue.TryParse("", out newvalue);
            if (parseOk) {
                response.Headers.RetryAfter = newvalue;
            }

            // Get the strong type out
            System.Diagnostics.Debug.WriteLine("Date value in ticks: {0}", response.Headers.Date.Value.Ticks);

            // The ToString() is useful for diagnostics, too.
            System.Diagnostics.Debug.WriteLine("The Date ToString() results: {0}", response.Headers.Date.ToString());
        }        

Remarks

The HttpDateOrDeltaHeaderValue class represents the Retry-After HTTP header on an HTTP response.

The RetryAfter property on the HttpResponseHeaderCollection returns an HttpDateOrDeltaHeaderValue object.

Properties

Date

Gets the value of the HTTP-date information used in the Retry-After HTTP header.

Delta

Gets the value of the delta-seconds information used in the Retry-After HTTP header.

Methods

Parse(String)

Converts a string to an HttpDateOrDeltaHeaderValue instance.

ToString()

Returns a string that represents the current HttpDateOrDeltaHeaderValue object.

TryParse(String, HttpDateOrDeltaHeaderValue)

Determines whether a string is valid HttpDateOrDeltaHeaderValue information.

Applies to

See also