Skip to content

IJsonDocument.TryGetContiguousLocalElement Method

Definition

Namespace: Corvus.Text.Json.Internal
Assembly: Corvus.Text.Json.dll
Source: IJsonDocument.cs

TryGetContiguousLocalElement(int, ReadOnlyMemory<byte>, int)

Attempts to expose the element at the specified index as a contiguous, fully-local segment: its complete raw UTF-8 (including any enclosing quotes or braces) and the document-text offset that segment starts at. Succeeds only when the element's metadata rows are local to this document and their locations all fall within the returned segment — an immutable parsed document qualifies; builders and synthetic documents return false.

public abstract bool TryGetContiguousLocalElement(int index, out ReadOnlyMemory<byte> utf8, out int sourceTextOffset)

Parameters

Name Type Description
index int The index of the element.
utf8 ReadOnlyMemory<byte> The element's complete raw UTF-8.
sourceTextOffset int The offset of utf8 within this document's text (the base the element's row locations are relative to).

Returns

bool

true when the contiguous local segment is available (and a subsequent AppendLocalElementRowsRebased is valid); otherwise false.

Applies To

Product Versions
.NET 9, 10
.NET Standard 2.0, 2.1

Collaborate with us on GitHub

The source for this content can be found on GitHub, where you can also create and review issues and pull requests.

Open an issue