HttpDateOrDeltaHeaderValue HttpDateOrDeltaHeaderValue HttpDateOrDeltaHeaderValue HttpDateOrDeltaHeaderValue HttpDateOrDeltaHeaderValue Class

Definition

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

public : sealed class HttpDateOrDeltaHeaderValue : IStringable
struct winrt::Windows::Web::Http::Headers::HttpDateOrDeltaHeaderValue : IStringable
public sealed class HttpDateOrDeltaHeaderValue : IStringable
Public NotInheritable Class HttpDateOrDeltaHeaderValue Implements IStringable
// This class does not provide a public constructor.
Attributes

Windows 10 requirements

Device family
Windows 10 (introduced v10.0.10240.0)
API contract
Windows.Foundation.UniversalApiContract (introduced v1)

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 Date Date Date Date

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

Delta Delta Delta Delta Delta

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

Methods

Parse(String) Parse(String) Parse(String) Parse(String) Parse(String)

Converts a string to an HttpDateOrDeltaHeaderValue instance.

ToString() ToString() ToString() ToString() ToString()

Returns a string that represents the current HttpDateOrDeltaHeaderValue object.

TryParse(String, HttpDateOrDeltaHeaderValue) TryParse(String, HttpDateOrDeltaHeaderValue) TryParse(String, HttpDateOrDeltaHeaderValue) TryParse(String, HttpDateOrDeltaHeaderValue) TryParse(String, HttpDateOrDeltaHeaderValue)

Determines whether a string is valid HttpDateOrDeltaHeaderValue information.

See also