Skip to content

IJsonDocument.TryGetLineAndOffset Method

Definition

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

TryGetLineAndOffset(int, int, int, long)

Tries to get the line number and character offset in the original source document for the element at the specified index.

public abstract bool TryGetLineAndOffset(int index, out int line, out int charOffset, out long lineByteOffset)

Parameters

Name Type Description
index int The index of the element.
line int When this method returns, contains the 1-based line number if successful.
charOffset int When this method returns, contains the 1-based character offset within the line if successful.
lineByteOffset long When this method returns, contains the byte offset of the start of the line if successful.

Returns

bool

true if the line and offset were successfully determined; 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