Share via


HeaderUtilities.TryParseSeconds Method

Definition

Try to find a target header value among the set of given header values and parse it as a TimeSpan.

public:
 static bool TryParseSeconds(Microsoft::Extensions::Primitives::StringValues headerValues, System::String ^ targetValue, [Runtime::InteropServices::Out] Nullable<TimeSpan> % value);
public static bool TryParseSeconds (Microsoft.Extensions.Primitives.StringValues headerValues, string targetValue, out TimeSpan? value);
static member TryParseSeconds : Microsoft.Extensions.Primitives.StringValues * string * Nullable -> bool
Public Shared Function TryParseSeconds (headerValues As StringValues, targetValue As String, ByRef value As Nullable(Of TimeSpan)) As Boolean

Parameters

headerValues
StringValues

The StringValues containing the set of header values to search.

targetValue
String

The target header value to look for.

value
Nullable<TimeSpan>

When this method returns, contains the parsed TimeSpan, if the parsing succeeded, or null if the parsing failed. The conversion fails if the targetValue was not found or could not be parsed as a TimeSpan. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.

Returns

true if targetValue is found and successfully parsed; otherwise, false.

Applies to