语言

JsonElement.TryGetDateTime(DateTime) 方法

定义

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

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

参数

value
DateTime

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

返回

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

例外

JsonDocument父级已被释放。

注解

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

适用于