Skip to content

IJsonDocument.TryGetLineAndOffset Method

Definition

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

TryGetLineAndOffset(int, ref int, ref int, ref 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, ref int line, ref int charOffset, ref long lineByteOffset)

Parameters

Name Type Description
index int The index of the element.
line ref int When this method returns, contains the 1-based line number if successful.
charOffset ref int When this method returns, contains the 1-based character offset within the line if successful.
lineByteOffset ref 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