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, IHttpDateOrDeltaHeaderValue
struct winrt::Windows::Web::Http::Headers::HttpDateOrDeltaHeaderValue : IStringable, IHttpDateOrDeltaHeaderValue
public sealed class HttpDateOrDeltaHeaderValue : IStringable, IHttpDateOrDeltaHeaderValue
Public NotInheritable Class HttpDateOrDeltaHeaderValue Implements IStringable, IHttpDateOrDeltaHeaderValue
// 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.

public : IReference<DateTime> Date { get; }
IReference<DateTime> Date();
public Nullable<DateTimeOffset> Date { get; }
Public ReadOnly Property Date As Nullable<DateTimeOffset>
var nullable = httpDateOrDeltaHeaderValue.date;
Value
Nullable<DateTimeOffset> Nullable<DateTimeOffset> Nullable<DateTimeOffset>

The value of the HTTP-date information.

Delta Delta Delta Delta Delta

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

public : IReference<TimeSpan> Delta { get; }
IReference<TimeSpan> Delta();
public Nullable<TimeSpan> Delta { get; }
Public ReadOnly Property Delta As Nullable<TimeSpan>
var nullable = httpDateOrDeltaHeaderValue.delta;
Value
Nullable<TimeSpan> Nullable<TimeSpan> Nullable<TimeSpan>

The value of the delta-seconds information.

Methods

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

Converts a string to an HttpDateOrDeltaHeaderValue instance.

public : static HttpDateOrDeltaHeaderValue Parse(Platform::String input)
HttpDateOrDeltaHeaderValue Parse(winrt::hstring input) const;
public static HttpDateOrDeltaHeaderValue Parse(String input)
Public Static Function Parse(input As String) As HttpDateOrDeltaHeaderValue
var httpDateOrDeltaHeaderValue = Windows.Web.Http.Headers.HttpDateOrDeltaHeaderValue.parse(input);
Parameters
input
String String String

A string that represents the HTTP-date or delta-seconds information in the Retry-After HTTP header.

Returns

Remarks

Below are the exceptions that this function throws.

E_INVALIDARG

The input parameter is null (Nothing in Visual Basic).

The input parameter is not valid HTTP-date or delta-seconds information.

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

Returns a string that represents the current HttpDateOrDeltaHeaderValue object.

public : Platform::String ToString()
winrt::hstring ToString() const;
public string ToString()
Public Function ToString() As string
var string = httpDateOrDeltaHeaderValue.toString();
Returns
string string string

A string that represents the current object.

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

Determines whether a string is valid HttpDateOrDeltaHeaderValue information.

public : static Platform::Boolean TryParse(Platform::String input, HttpDateOrDeltaHeaderValue dateOrDeltaHeaderValue)
bool TryParse(winrt::hstring input, HttpDateOrDeltaHeaderValue dateOrDeltaHeaderValue) const;
public static bool TryParse(String input, HttpDateOrDeltaHeaderValue dateOrDeltaHeaderValue)
Public Static Function TryParse(input As String, dateOrDeltaHeaderValue As HttpDateOrDeltaHeaderValue) As bool
var bool = Windows.Web.Http.Headers.HttpDateOrDeltaHeaderValue.tryParse(input, dateOrDeltaHeaderValue);
Parameters
input
String String String

The string to validate.

Returns
bool bool bool

true if input is valid HttpDateOrDeltaHeaderValue information; otherwise, false.