Table of Contents

ToCharSpan Method

ToCharSpan<T>(T, ReadOnlySpan<char>, IFormatProvider?)

public static ReadOnlySpan<char> ToCharSpan<T>(this T value, ReadOnlySpan<char> format = default, IFormatProvider? provider = null) where T : IFormattable

Allocation-free instant formatter.

Parameters

value T
format ReadOnlySpan<char>
provider IFormatProvider

Returns

ReadOnlySpan<char>

Type Parameters

T

Remarks

NOTE: using ring buffer internally so that it cannot be called repeatedly in short term. ie. resulting span must be evaluated before another calls that could change array items in range referenced by resulting span.
See RING_BUFFER_SIZE to see available ring buffer size or call RingBufferScope(char[]) to use your own buffer.