편집

다음을 통해 공유


JsonElement.TryGetProperty Method

Definition

Overloads

TryGetProperty(String, JsonElement)

Looks for a property named propertyName in the current object, returning a value that indicates whether or not such a property exists. When the property exists, its value is assigned to the value argument.

TryGetProperty(ReadOnlySpan<Byte>, JsonElement)

Looks for a property named utf8PropertyName in the current object, returning a value that indicates whether or not such a property exists. When the property exists, the method assigns its value to the value argument.

TryGetProperty(ReadOnlySpan<Char>, JsonElement)

Looks for a property named propertyName in the current object, returning a value that indicates whether or not such a property exists. When the property exists, the method assigns its value to the value argument.

TryGetProperty(String, JsonElement)

Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs

Looks for a property named propertyName in the current object, returning a value that indicates whether or not such a property exists. When the property exists, its value is assigned to the value argument.

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

Parameters

propertyName
String

The name of the property to find.

value
JsonElement

When this method returns, contains the value of the specified property.

Returns

true if the property was found; otherwise, false.

Exceptions

propertyName is null.

The parent JsonDocument has been disposed.

Remarks

Property name matching is performed as an ordinal, case-sensitive comparison.

If a property is defined multiple times for the same object, the method matches the last such definition.

Applies to

TryGetProperty(ReadOnlySpan<Byte>, JsonElement)

Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs

Looks for a property named utf8PropertyName in the current object, returning a value that indicates whether or not such a property exists. When the property exists, the method assigns its value to the value argument.

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

Parameters

utf8PropertyName
ReadOnlySpan<Byte>

The UTF-8 (with no Byte-Order-Mark (BOM)) representation of the name of the property to return.

value
JsonElement

Receives the value of the located property.

Returns

true if the property was found; otherwise, false.

Exceptions

The parent JsonDocument has been disposed.

Remarks

Property name matching is performed as an ordinal, case-sensitive comparison.

If a property is defined multiple times for the same object, the method matches the last such definition.

For more information, see How to write custom serializers and deserializers with System.Text.Json.

Applies to

TryGetProperty(ReadOnlySpan<Char>, JsonElement)

Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs
Source:
JsonElement.cs

Looks for a property named propertyName in the current object, returning a value that indicates whether or not such a property exists. When the property exists, the method assigns its value to the value argument.

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

Parameters

propertyName
ReadOnlySpan<Char>

The name of the property to find.

value
JsonElement

When this method returns, contains the value of the specified property.

Returns

true if the property was found; otherwise, false.

Exceptions

The parent JsonDocument has been disposed.

Remarks

Property name matching is performed as an ordinal, case-sensitive comparison.

If a property is defined multiple times for the same object, the method matches the last such definition.

Applies to