Skip to content

FixedJsonValueDocument<T>.ForNumberFromSpan Method

Definition

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

Overloads

Method Description
ForNumberFromSpan(ReadOnlySpan<byte>) Creates a FixedJsonValueDocument for a number value from a span, copying the data into the document's internal buffer (zero heap...
ForNumberFromSpan(ReadOnlySpan<char>) Creates a FixedJsonValueDocument for a number value from a char span, transcoding UTF-16 to UTF-8 (zero heap allocation).

ForNumberFromSpan(ReadOnlySpan<byte>)

Source: FixedJsonValueDocument.cs

Creates a FixedJsonValueDocument for a number value from a span, copying the data into the document's internal buffer (zero heap allocation).

public static FixedJsonValueDocument<T> ForNumberFromSpan(ReadOnlySpan<byte> rawUtf8Number)

Parameters

Name Type Description
rawUtf8Number ReadOnlySpan<byte> The raw UTF-8 number bytes (unquoted). Must be <= 64 bytes.

Returns

FixedJsonValueDocument<T>

A pooled document instance wrapping the number value.

Applies To

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

ForNumberFromSpan(ReadOnlySpan<char>)

Source: FixedJsonValueDocument.cs

Creates a FixedJsonValueDocument for a number value from a char span, transcoding UTF-16 to UTF-8 (zero heap allocation).

public static FixedJsonValueDocument<T> ForNumberFromSpan(ReadOnlySpan<char> chars)

Parameters

Name Type Description
chars ReadOnlySpan<char> The number text as chars (e.g., "42", "3.14"). Must contain only ASCII digits, sign, decimal point, and exponent characters.

Returns

FixedJsonValueDocument<T>

A pooled document instance wrapping the number value.

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