HeaderUtilities.TryParseSeconds 方法

定义

尝试在给定标头值集中查找目标标头值,并将其分析为 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

参数

headerValues
StringValues

包含 StringValues 要搜索的标头值集的 。

targetValue
String

要查找的目标标头值。

value
Nullable<TimeSpan>

此方法返回时,如果分析成功,则包含已 TimeSpan分析的 ;如果分析失败,则包含 null。 如果未 targetValue 找到或无法解析为 TimeSpan,则转换将失败。 此参数未经初始化即进行传递;最初在 result 中提供的任何值都会被覆盖。

返回

true 如果 targetValue 找到并成功分析,则为 ;否则为 false

适用于