JsonElement.TryGetDateTimeOffset(DateTimeOffset) 方法

定义

尝试将当前 JSON 字符串表示为 .DateTimeOffset

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

此方法返回时,包含与当前 JSON 字符串等效的日期和时间值(如果转换成功或 MinValue 转换失败)。

返回

如果字符串可以表示为 ,则为 />;否则为

例外

JsonDocument父级已被释放。

注解

此方法仅创建符合 ISO 8601-1 扩展格式的 JSON 字符串的 DateTimeOffset 表示形式(请参阅 System.Text.Json 中的 DateTime 和 DateTimeOffset 支持)。

适用于