Edit

Share via


JsonMarshal.GetRawUtf8PropertyName(JsonProperty) Method

Definition

Gets a ReadOnlySpan<T> view over the raw JSON data of the given JsonProperty name.

public:
 static ReadOnlySpan<System::Byte> GetRawUtf8PropertyName(System::Text::Json::JsonProperty property);
public static ReadOnlySpan<byte> GetRawUtf8PropertyName(System.Text.Json.JsonProperty property);
static member GetRawUtf8PropertyName : System.Text.Json.JsonProperty -> ReadOnlySpan<byte>
Public Shared Function GetRawUtf8PropertyName (property As JsonProperty) As ReadOnlySpan(Of Byte)

Parameters

property
JsonProperty

The JSON property from which to extract the span.

Returns

The span containing the raw JSON data of the property name. This will not include the enclosing quotes.

Exceptions

The underlying JsonDocument has been disposed.

Remarks

While the method itself does check for disposal of the underlying JsonDocument, it is possible that it could be disposed after the method returns, which would result in the span pointing to a buffer that has been returned to the shared pool. Callers should take extra care to make sure that such a scenario isn't possible to avoid potential data corruption.

Applies to