Class CharBuffer
Providers extension methods to work with char buffers.
Inherited Members
Namespace: DotNext.Buffers
Assembly: DotNext.dll
Syntax
public static class CharBuffer
  Methods
| Edit this page View SourceConcat(ref BufferWriterSlim<char>, scoped ReadOnlySpan<string?>)
Writes concatenated strings.
Declaration
public static void Concat(this ref BufferWriterSlim<char> writer, scoped ReadOnlySpan<string?> values)
  Parameters
| Type | Name | Description | 
|---|---|---|
| BufferWriterSlim<char> | writer | The buffer writer.  | 
      
| ReadOnlySpan<string> | values | An array of strings.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| OutOfMemoryException | The concatenated string is too large.  | 
      
Concat(IBufferWriter<char>, scoped ReadOnlySpan<string?>)
Writes concatenated strings.
Declaration
public static void Concat(this IBufferWriter<char> writer, scoped ReadOnlySpan<string?> values)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IBufferWriter<char> | writer | The buffer writer.  | 
      
| ReadOnlySpan<string> | values | An array of strings.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| OutOfMemoryException | The concatenated string is too large.  | 
      
Format(ref BufferWriterSlim<char>, CompositeFormat, scoped ReadOnlySpan<object?>, IFormatProvider?)
Writes formatted string to the buffer.
Declaration
public static int Format(this ref BufferWriterSlim<char> writer, CompositeFormat format, scoped ReadOnlySpan<object?> args, IFormatProvider? provider = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| BufferWriterSlim<char> | writer | The buffer writer.  | 
      
| CompositeFormat | format | Formatting template.  | 
      
| ReadOnlySpan<object> | args | The arguments to be rendered as a part of template.  | 
      
| IFormatProvider | provider | A culture-specific formatting information.  | 
      
Returns
| Type | Description | 
|---|---|
| int | The number of written characters.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| InsufficientMemoryException | 
  | 
      
Format(IBufferWriter<char>, CompositeFormat, ReadOnlySpan<object?>, IFormatProvider?)
Writes formatted string to the buffer.
Declaration
public static int Format(this IBufferWriter<char> writer, CompositeFormat format, ReadOnlySpan<object?> args, IFormatProvider? provider = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IBufferWriter<char> | writer | The buffer writer.  | 
      
| CompositeFormat | format | Formatting template.  | 
      
| ReadOnlySpan<object> | args | The arguments to be rendered as a part of template.  | 
      
| IFormatProvider | provider | A culture-specific formatting information.  | 
      
Returns
| Type | Description | 
|---|---|
| int | The number of written characters.  | 
      
Exceptions
| Type | Condition | 
|---|---|
| InsufficientMemoryException | 
  | 
      
Format<T>(ref BufferWriterSlim<char>, T, string?, IFormatProvider?)
Writes the value as a string.
Declaration
public static int Format<T>(this ref BufferWriterSlim<char> writer, T value, string? format = null, IFormatProvider? provider = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| BufferWriterSlim<char> | writer | The buffer writer.  | 
      
| T | value | The value to convert.  | 
      
| string | format | The format of the value.  | 
      
| IFormatProvider | provider | The format provider.  | 
      
Returns
| Type | Description | 
|---|---|
| int | The number of written characters.  | 
      
Type Parameters
| Name | Description | 
|---|---|
| T | The type of the value.  | 
      
Format<T>(IBufferWriter<char>, T, string?, IFormatProvider?)
Writes the value as a string.
Declaration
public static int Format<T>(this IBufferWriter<char> writer, T value, string? format = null, IFormatProvider? provider = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IBufferWriter<char> | writer | The buffer writer.  | 
      
| T | value | The value to convert.  | 
      
| string | format | The format of the value.  | 
      
| IFormatProvider | provider | The format provider.  | 
      
Returns
| Type | Description | 
|---|---|
| int | The number of written characters.  | 
      
Type Parameters
| Name | Description | 
|---|---|
| T | The type of the value.  | 
      
Interpolate(ref BufferWriterSlim<char>, scoped in BufferWriterSlimInterpolatedStringHandler)
Writes interpolated string to the buffer.
Declaration
public static int Interpolate(this ref BufferWriterSlim<char> writer, scoped in BufferWriterSlimInterpolatedStringHandler handler)
  Parameters
| Type | Name | Description | 
|---|---|---|
| BufferWriterSlim<char> | writer | The buffer writer.  | 
      
| BufferWriterSlimInterpolatedStringHandler | handler | The handler of the interpolated string.  | 
      
Returns
| Type | Description | 
|---|---|
| int | The number of written characters.  | 
      
Interpolate(ref BufferWriterSlim<char>, IFormatProvider?, scoped in BufferWriterSlimInterpolatedStringHandler)
Writes interpolated string to the buffer.
Declaration
public static int Interpolate(this ref BufferWriterSlim<char> writer, IFormatProvider? provider, scoped in BufferWriterSlimInterpolatedStringHandler handler)
  Parameters
| Type | Name | Description | 
|---|---|---|
| BufferWriterSlim<char> | writer | The buffer writer.  | 
      
| IFormatProvider | provider | The formatting provider.  | 
      
| BufferWriterSlimInterpolatedStringHandler | handler | The handler of the interpolated string.  | 
      
Returns
| Type | Description | 
|---|---|
| int | The number of written characters.  | 
      
Interpolate(IBufferWriter<char>, in BufferWriterInterpolatedStringHandler)
Writes interpolated string to the buffer.
Declaration
public static int Interpolate(this IBufferWriter<char> writer, in BufferWriterInterpolatedStringHandler handler)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IBufferWriter<char> | writer | The buffer writer.  | 
      
| BufferWriterInterpolatedStringHandler | handler | The handler of the interpolated string.  | 
      
Returns
| Type | Description | 
|---|---|
| int | The number of written characters.  | 
      
Interpolate(IBufferWriter<char>, IFormatProvider?, in BufferWriterInterpolatedStringHandler)
Writes interpolated string to the buffer.
Declaration
public static int Interpolate(this IBufferWriter<char> writer, IFormatProvider? provider, in BufferWriterInterpolatedStringHandler handler)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IBufferWriter<char> | writer | The buffer writer.  | 
      
| IFormatProvider | provider | The formatting provider.  | 
      
| BufferWriterInterpolatedStringHandler | handler | The handler of the interpolated string.  | 
      
Returns
| Type | Description | 
|---|---|
| int | The number of written characters.  | 
      
TryFormat(ref SpanWriter<char>, CompositeFormat, scoped ReadOnlySpan<object?>, IFormatProvider?)
Tries to write formatted string to the buffer.
Declaration
public static bool TryFormat(this ref SpanWriter<char> writer, CompositeFormat format, scoped ReadOnlySpan<object?> args, IFormatProvider? provider = null)
  Parameters
| Type | Name | Description | 
|---|---|---|
| SpanWriter<char> | writer | The buffer writer.  | 
      
| CompositeFormat | format | Formatting template.  | 
      
| ReadOnlySpan<object> | args | The arguments to be rendered as a part of template.  | 
      
| IFormatProvider | provider | A culture-specific formatting information.  | 
      
Returns
| Type | Description | 
|---|---|
| bool | true if   | 
      
TryFormat<T>(ref SpanWriter<char>, T, scoped ReadOnlySpan<char>, IFormatProvider?)
Converts the value to a set of characters and writes them to the buffer.
Declaration
public static bool TryFormat<T>(this ref SpanWriter<char> writer, T value, scoped ReadOnlySpan<char> format = default, IFormatProvider? provider = null) where T : ISpanFormattable
  Parameters
| Type | Name | Description | 
|---|---|---|
| SpanWriter<char> | writer | The buffer writer.  | 
      
| T | value | The value to be converted to a set of characters.  | 
      
| ReadOnlySpan<char> | format | The format of the value.  | 
      
| IFormatProvider | provider | The format provider.  | 
      
Returns
| Type | Description | 
|---|---|
| bool | true if   | 
      
Type Parameters
| Name | Description | 
|---|---|
| T | The formattable type.  | 
      
Write(ref BufferWriterSlim<char>, StringBuilder)
Writes the contents of string builder to the buffer.
Declaration
public static void Write(this ref BufferWriterSlim<char> writer, StringBuilder input)
  Parameters
| Type | Name | Description | 
|---|---|---|
| BufferWriterSlim<char> | writer | The buffer writer.  | 
      
| StringBuilder | input | The string builder.  | 
      
Write(ref SpanWriter<char>, StringBuilder)
Writes the contents of a string builder to the buffer.
Declaration
public static void Write(this ref SpanWriter<char> writer, StringBuilder input)
  Parameters
| Type | Name | Description | 
|---|---|---|
| SpanWriter<char> | writer | The buffer writer.  | 
      
| StringBuilder | input | The string builder.  | 
      
Write(IBufferWriter<char>, StringBuilder)
Writes the contents of string builder to the buffer.
Declaration
public static void Write(this IBufferWriter<char> writer, StringBuilder input)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IBufferWriter<char> | writer | The buffer writer.  | 
      
| StringBuilder | input | The string builder.  | 
      
WriteLine(ref BufferWriterSlim<char>)
Writes line termination symbols to the buffer.
Declaration
public static void WriteLine(this ref BufferWriterSlim<char> writer)
  Parameters
| Type | Name | Description | 
|---|---|---|
| BufferWriterSlim<char> | writer | The buffer writer.  | 
      
WriteLine(ref BufferWriterSlim<char>, scoped ReadOnlySpan<char>)
Writes a string to the buffer, followed by a line terminator.
Declaration
public static void WriteLine(this ref BufferWriterSlim<char> writer, scoped ReadOnlySpan<char> characters)
  Parameters
| Type | Name | Description | 
|---|---|---|
| BufferWriterSlim<char> | writer | The buffer writer.  | 
      
| ReadOnlySpan<char> | characters | The characters to write.  | 
      
WriteLine(IBufferWriter<char>)
Writes line termination symbols to the buffer.
Declaration
public static void WriteLine(this IBufferWriter<char> writer)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IBufferWriter<char> | writer | The buffer writer.  | 
      
WriteLine(IBufferWriter<char>, scoped ReadOnlySpan<char>)
Writes a string to the buffer, followed by a line terminator.
Declaration
public static void WriteLine(this IBufferWriter<char> writer, scoped ReadOnlySpan<char> characters)
  Parameters
| Type | Name | Description | 
|---|---|---|
| IBufferWriter<char> | writer | The buffer writer.  | 
      
| ReadOnlySpan<char> | characters | The characters to write.  |