Utf8JsonReader.TryGetDateTimeOffset(DateTimeOffset) 方法

定义

尝试将源中的当前 JSON 令牌值分析为 DateTimeOffset,并返回一个指示操作是否成功的值。Tries to parse the current JSON token value from the source as a DateTimeOffset and returns a value that indicates whether the operation succeeded.

public:
 bool TryGetDateTimeOffset([Runtime::InteropServices::Out] DateTimeOffset % value);
public bool TryGetDateTimeOffset (out DateTimeOffset value);
member this.TryGetDateTimeOffset : DateTimeOffset -> bool
Public Function TryGetDateTimeOffset (ByRef value As DateTimeOffset) As Boolean

参数

value
DateTimeOffset

在此方法返回时,包含已解析的值。When this method returns, contains the parsed value.

返回

Boolean

如果可以将整个 UTF-8 编码令牌值成功解析为 DateTimeOffset 值,则为 true;否则为 falsetrue if the entire UTF-8 encoded token value can be successfully parsed to a DateTimeOffset value; otherwise, false.

例外

JSON 令牌的值不是 StringThe value of the JSON token isn't a String.

注解

此方法仅创建 DateTimeOffset 符合 ISO 8601-1 扩展格式的 JSON 字符串的表示形式 (参阅) System.Text.Js上的 DateTime 和 DateTimeOffset 支持This method only creates a DateTimeOffset representation of JSON strings that conform to the ISO 8601-1 extended format (see DateTime and DateTimeOffset support in System.Text.Json).

适用于

另请参阅