語言

JsonElement.TryGetProperty 方法

定義

多載

名稱 Description
TryGetProperty(String, JsonElement)

尋找目前物件中命名 propertyName 的屬性,回傳一個值以指示該屬性是否存在。 當該性質存在時,其值會被 value 賦予參數。

TryGetProperty(ReadOnlySpan<Byte>, JsonElement)

尋找目前物件中命名 utf8PropertyName 的屬性,回傳一個值以指示該屬性是否存在。 當該屬性存在時,方法會將其值指派給 value 參數。

TryGetProperty(ReadOnlySpan<Char>, JsonElement)

尋找目前物件中命名 propertyName 的屬性,回傳一個值以指示該屬性是否存在。 當該屬性存在時,方法會將其值指派給 value 參數。

TryGetProperty(String, JsonElement)

來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
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

例外狀況

這個值的 ValueKind 值不是 Object。

propertyName 是 null。

父母 JsonDocument 已被處理掉。

備註

屬性名稱匹配以序數、大小寫區分的比較方式進行。

如果同一物件的屬性被多次定義,該方法會匹配最後一次定義。

另請參閱

適用於

TryGetProperty(ReadOnlySpan<Byte>, JsonElement)

來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
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

例外狀況

這個值的 ValueKind 值不是 Object。

父母 JsonDocument 已被處理掉。

備註

屬性名稱匹配以序數、大小寫區分的比較方式進行。

如果同一物件的屬性被多次定義,該方法會匹配最後一次定義。

欲了解更多資訊,請參閱 如何使用 System.Text.JSON 撰寫自訂序列化器與解序列器。

另請參閱

適用於

TryGetProperty(ReadOnlySpan<Char>, JsonElement)

來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
JsonElement.cs
來源:
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

例外狀況

這個值的 ValueKind 值不是 Object。

父母 JsonDocument 已被處理掉。

備註

屬性名稱匹配以序數、大小寫區分的比較方式進行。

如果同一物件的屬性被多次定義,該方法會匹配最後一次定義。

另請參閱

適用於