JsonElement.TryGetProperty 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| TryGetProperty(String, JsonElement) |
查找在当前对象中命名 |
| TryGetProperty(ReadOnlySpan<Byte>, JsonElement) |
查找在当前对象中命名 |
| TryGetProperty(ReadOnlySpan<Char>, JsonElement) |
查找在当前对象中命名 |
TryGetProperty(String, JsonElement)
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
查找在当前对象中命名 propertyName 的属性,返回一个值,该值指示是否存在此类属性。 当属性存在时,其值将赋给 value 参数。
public:
bool TryGetProperty(System::String ^ propertyName, [Runtime::InteropServices::Out] System::Text::Json::JsonElement % value);
public bool TryGetProperty(string propertyName, out System.Text.Json.JsonElement value);
member this.TryGetProperty : string * JsonElement -> bool
Public Function TryGetProperty (propertyName As String, ByRef value As JsonElement) As Boolean
参数
- propertyName
- String
要查找的属性的名称。
- value
- JsonElement
此方法返回时,包含指定属性的值。
返回
true 如果找到该属性,则为 ;否则,为 false.
例外
propertyName 是 null。
注解
属性名称匹配作为序号、区分大小写的比较执行。
如果为同一对象多次定义属性,该方法将匹配最后一个此类定义。
另请参阅
适用于
TryGetProperty(ReadOnlySpan<Byte>, JsonElement)
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
查找在当前对象中命名 utf8PropertyName 的属性,返回一个值,该值指示是否存在此类属性。 当属性存在时,该方法会将其值 value 分配给参数。
public:
bool TryGetProperty(ReadOnlySpan<System::Byte> utf8PropertyName, [Runtime::InteropServices::Out] System::Text::Json::JsonElement % value);
public bool TryGetProperty(ReadOnlySpan<byte> utf8PropertyName, out System.Text.Json.JsonElement value);
member this.TryGetProperty : ReadOnlySpan<byte> * JsonElement -> bool
Public Function TryGetProperty (utf8PropertyName As ReadOnlySpan(Of Byte), ByRef value As JsonElement) As Boolean
参数
- utf8PropertyName
- ReadOnlySpan<Byte>
要返回的属性名称的 UTF-8(无字节Order-Mark (BOM)表示形式。
- value
- JsonElement
接收定位属性的值。
返回
true 如果找到该属性,则为 ;否则,为 false.
例外
注解
属性名称匹配作为序号、区分大小写的比较执行。
如果为同一对象多次定义属性,该方法将匹配最后一个此类定义。
有关详细信息,请参阅 如何使用 System.Text.Json 编写自定义序列化程序和反序列化程序。
另请参阅
适用于
TryGetProperty(ReadOnlySpan<Char>, JsonElement)
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
- Source:
- JsonElement.cs
查找在当前对象中命名 propertyName 的属性,返回一个值,该值指示是否存在此类属性。 当属性存在时,该方法会将其值 value 分配给参数。
public:
bool TryGetProperty(ReadOnlySpan<char> propertyName, [Runtime::InteropServices::Out] System::Text::Json::JsonElement % value);
public bool TryGetProperty(ReadOnlySpan<char> propertyName, out System.Text.Json.JsonElement value);
member this.TryGetProperty : ReadOnlySpan<char> * JsonElement -> bool
Public Function TryGetProperty (propertyName As ReadOnlySpan(Of Char), ByRef value As JsonElement) As Boolean
参数
- propertyName
- ReadOnlySpan<Char>
要查找的属性的名称。
- value
- JsonElement
此方法返回时,包含指定属性的值。
返回
true 如果找到该属性,则为 ;否则,为 false.
例外
注解
属性名称匹配作为序号、区分大小写的比较执行。
如果为同一对象多次定义属性,该方法将匹配最后一个此类定义。