Skip to content

IJsonDocument.TryFormat Method

Definition

Namespace: Corvus.Text.Json.Internal
Assembly: Corvus.Text.Json.dll

Overloads

Method Description
TryFormat(int, Span<char>, ref int, ReadOnlySpan<char>, IFormatProvider) Formats the value to the provided destination span according to the specified format and format provider.
TryFormat(int, Span<byte>, ref int, ReadOnlySpan<char>, IFormatProvider) Formats the value to the provided destination UTF-8 span according to the specified format and format provider.

TryFormat(int, Span<char>, ref int, ReadOnlySpan<char>, IFormatProvider)

Source: IJsonDocument.cs

Formats the value to the provided destination span according to the specified format and format provider.

public abstract bool TryFormat(int index, Span<char> destination, ref int charsWritten, ReadOnlySpan<char> format, IFormatProvider formatProvider)

Parameters

Name Type Description
index int The index of the element.
destination Span<char> The destination span to write the formatted value to.
charsWritten ref int The number of characters written to the destination span.
format ReadOnlySpan<char> The format string.
formatProvider IFormatProvider The format provider.

Returns

bool

true if the formatting was successful; otherwise, false.

Applies To

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

TryFormat(int, Span<byte>, ref int, ReadOnlySpan<char>, IFormatProvider)

Source: IJsonDocument.cs

Formats the value to the provided destination UTF-8 span according to the specified format and format provider.

public abstract bool TryFormat(int index, Span<byte> destination, ref int charsWritten, ReadOnlySpan<char> format, IFormatProvider formatProvider)

Parameters

Name Type Description
index int The index of the element.
destination Span<byte> The destination span to write the UTF-8 formatted value to.
charsWritten ref int
format ReadOnlySpan<char> The format string.
formatProvider IFormatProvider The format provider.

Returns

bool

true if the formatting was successful; 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