HttpDateOrDeltaHeaderValue
HttpDateOrDeltaHeaderValue
HttpDateOrDeltaHeaderValue
HttpDateOrDeltaHeaderValue
Class
Definition
Represents the value of the Retry-After HTTP header on an HTTP response.
public : sealed class HttpDateOrDeltaHeaderValue : IStringable, IHttpDateOrDeltaHeaderValuepublic sealed class HttpDateOrDeltaHeaderValue : IStringable, IHttpDateOrDeltaHeaderValuePublic NotInheritable Class HttpDateOrDeltaHeaderValue Implements IStringable, IHttpDateOrDeltaHeaderValue// You can use this class in JavaScript.
- Attributes
| 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
Gets the value of the HTTP-date information used in the Retry-After HTTP header.
public : IReference<DateTime> Date { get; }public Nullable<DateTimeOffset> Date { get; }Public ReadOnly Property Date As Nullable<DateTimeOffset>// You can use this property in JavaScript.
- Value
- IReference<DateTime> Nullable<DateTimeOffset> Nullable<DateTimeOffset> Nullable<DateTimeOffset>
The value of the HTTP-date information.
Delta Delta Delta Delta
Gets the value of the delta-seconds information used in the Retry-After HTTP header.
public : IReference<TimeSpan> Delta { get; }public Nullable<TimeSpan> Delta { get; }Public ReadOnly Property Delta As Nullable<TimeSpan>// You can use this property in JavaScript.
- Value
- IReference<TimeSpan> Nullable<TimeSpan> Nullable<TimeSpan> Nullable<TimeSpan>
The value of the delta-seconds information.
Methods
Parse(String) Parse(String) Parse(String) Parse(String)
Converts a string to an HttpDateOrDeltaHeaderValue instance.
public : static HttpDateOrDeltaHeaderValue Parse(PlatForm::String input)public static HttpDateOrDeltaHeaderValue Parse(String input)Public Static Function Parse(input As String) As HttpDateOrDeltaHeaderValue// You can use this method in JavaScript.
- input
- PlatForm::String String String String
A string that represents the HTTP-date or delta-seconds information in the Retry-After HTTP header.
An HttpDateOrDeltaHeaderValue instance.
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()
Returns a string that represents the current HttpDateOrDeltaHeaderValue object.
public : PlatForm::String ToString()public string ToString()Public Function ToString() As string// You can use this method in JavaScript.
A string that represents the current object.
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)public static bool TryParse(String input, HttpDateOrDeltaHeaderValue dateOrDeltaHeaderValue)Public Static Function TryParse(input As String, dateOrDeltaHeaderValue As HttpDateOrDeltaHeaderValue) As bool// You can use this method in JavaScript.
- input
- PlatForm::String String String String
The string to validate.
- dateOrDeltaHeaderValue
- HttpDateOrDeltaHeaderValue HttpDateOrDeltaHeaderValue HttpDateOrDeltaHeaderValue HttpDateOrDeltaHeaderValue
The HttpDateOrDeltaHeaderValue version of the string.
true if input is valid HttpDateOrDeltaHeaderValue information; otherwise, false.