Table of Contents

Struct StringMakerHandle

Namespace
Switchboard
Assembly
Switchboard.StringMaker.dll

Provides a readonly ref struct facade for StringMaker.

public readonly ref struct StringMakerHandle

Constructors

StringMakerHandle(StringMaker)

Initializes a new instance with the stringMaker as the internal reference.

public StringMakerHandle(StringMaker stringMaker)

Parameters

stringMaker StringMaker

The StringMaker to contain within the StringMakerHandle.

Properties

Length

Gets the current character count, the number of characters that will be copied during operations like ToString() or CopyTo(Span<char>).

public int Length { get; set; }

Exceptions

ArgumentOutOfRangeException

Thrown if the set value is less than zero.

NumberFormat

Gets or sets the FloatFormatInfo used to format number values.

public FloatFormatInfo NumberFormat { get; set; }

Methods

Append(bool)

Appends a boolean value.

public StringMakerHandle Append(bool value)

Parameters

value bool

The boolean value to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Append(char)

Appends a character.

public StringMakerHandle Append(char value)

Parameters

value char

The character to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Append(char, int)

Appends a repeating character.

public StringMakerHandle Append(char value, int count)

Parameters

value char

The character to append.

count int

The number of times to repeat the character.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Append(DateTime)

Appends a DateTime.

public StringMakerHandle Append(DateTime value)

Parameters

value DateTime

The DateTime to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Append(DateTime, int)

Appends a DateTime.

public StringMakerHandle Append(DateTime value, int subSecondPrecision)

Parameters

value DateTime

The DateTime to append.

subSecondPrecision int

The number of digits to display for fractions of a second.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Append(double)

Appends a double-precision floating-point number.

public StringMakerHandle Append(double value)

Parameters

value double

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Append(double, FloatFormatInfo)

Appends a double-precision floating-point number.

public StringMakerHandle Append(double value, FloatFormatInfo format)

Parameters

value double

The number to append.

format FloatFormatInfo

The format configuration info used to append the result.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Append(double, int)

Appends a double-precision floating-point number.

public StringMakerHandle Append(double value, int minFractionalDigits)

Parameters

value double

The number to append.

minFractionalDigits int

The minimum number of fractional digits to display.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Exceptions

ArgumentOutOfRangeException

Thrown if minFractionalDigits is less than zero.

Append(double, int, int)

Appends a double-precision floating-point number.

public StringMakerHandle Append(double value, int minFractionalDigits, int maxFractionalDigits)

Parameters

value double

The number to append.

minFractionalDigits int

The minimum number of fractional digits to display.

maxFractionalDigits int

The maximum number of fractional digits to display.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Exceptions

ArgumentOutOfRangeException

Thrown if minFractionalDigits or maxFractionalDigits are less than zero, or if minFractionalDigits is greater than maxFractionalDigits.

Append(double, int, int, bool)

Appends a double-precision floating-point number.

public StringMakerHandle Append(double value, int minFractionalDigits, int maxFractionalDigits, bool groupDigits)

Parameters

value double

The number to append.

minFractionalDigits int

The minimum number of fractional digits to display.

maxFractionalDigits int

The maximum number of fractional digits to display.

groupDigits bool

Whether to separate digit groups with a comma.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Exceptions

ArgumentOutOfRangeException

Thrown if minFractionalDigits or maxFractionalDigits are less than zero, or if minFractionalDigits is greater than maxFractionalDigits.

Append(long)

Appends a long integer.

public StringMakerHandle Append(long value)

Parameters

value long

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Append(long, char)

Appends a long integer.

public StringMakerHandle Append(long value, char digitGroupSeparator)

Parameters

value long

The number to append.

digitGroupSeparator char

The character to use for separating digit groups.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Append(ReadOnlySpan<char>)

Appends a ReadOnlySpan<T> of characters.

public StringMakerHandle Append(ReadOnlySpan<char> value)

Parameters

value ReadOnlySpan<char>

The ReadOnlySpan<T> of characters to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Append(ulong)

Appends an unsinged long integer.

public StringMakerHandle Append(ulong value)

Parameters

value ulong

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Append(ulong, char)

Appends an unsinged long integer.

public StringMakerHandle Append(ulong value, char digitGroupSeparator)

Parameters

value ulong

The number to append.

digitGroupSeparator char

The character to use for separating digit groups.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendBinary(byte)

Appends a byte as a binary value.

public StringMakerHandle AppendBinary(byte value)

Parameters

value byte

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendBinary(short)

Appends a short integer as a binary value.

public StringMakerHandle AppendBinary(short value)

Parameters

value short

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendBinary(short, char)

Appends a short integer as a binary value.

public StringMakerHandle AppendBinary(short value, char digitGroupSeparator)

Parameters

value short

The number to append.

digitGroupSeparator char

The character to use for separating digit groups.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendBinary(int)

Appends an integer as a binary value.

public StringMakerHandle AppendBinary(int value)

Parameters

value int

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendBinary(int, char)

Appends an integer as a binary value.

public StringMakerHandle AppendBinary(int value, char digitGroupSeparator)

Parameters

value int

The number to append.

digitGroupSeparator char

The character to use for separating digit groups.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendBinary(long)

Appends a long integer as a binary value.

public StringMakerHandle AppendBinary(long value)

Parameters

value long

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendBinary(long, char)

Appends a long integer as a binary value.

public StringMakerHandle AppendBinary(long value, char digitGroupSeparator)

Parameters

value long

The number to append.

digitGroupSeparator char

The character to use for separating digit groups.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendBinary(sbyte)

Appends a signed byte as a binary value.

public StringMakerHandle AppendBinary(sbyte value)

Parameters

value sbyte

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendBinary(ushort)

Appends an unsigned short integer as a binary value.

public StringMakerHandle AppendBinary(ushort value)

Parameters

value ushort

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendBinary(ushort, char)

Appends an unsigned short integer as a binary value.

public StringMakerHandle AppendBinary(ushort value, char digitGroupSeparator)

Parameters

value ushort

The number to append.

digitGroupSeparator char

The character to use for separating digit groups.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendBinary(uint)

Appends an unsigned integer as a binary value.

public StringMakerHandle AppendBinary(uint value)

Parameters

value uint

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendBinary(uint, char)

Appends an unsigned integer as a binary value.

public StringMakerHandle AppendBinary(uint value, char digitGroupSeparator)

Parameters

value uint

The number to append.

digitGroupSeparator char

The character to use for separating digit groups.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendBinary(ulong)

Appends an unsigned long integer as a binary value.

public StringMakerHandle AppendBinary(ulong value)

Parameters

value ulong

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendBinary(ulong, char)

Appends an unsigned long integer as a binary value.

public StringMakerHandle AppendBinary(ulong value, char digitGroupSeparator)

Parameters

value ulong

The number to append.

digitGroupSeparator char

The character to use for separating digit groups.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendHexadecimal(byte)

Appends a byte as a hexadecimal value.

public StringMakerHandle AppendHexadecimal(byte value)

Parameters

value byte

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendHexadecimal(short)

Appends a short integer as a hexadecimal value.

public StringMakerHandle AppendHexadecimal(short value)

Parameters

value short

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendHexadecimal(short, char)

Appends a short integer as a hexadecimal value.

public StringMakerHandle AppendHexadecimal(short value, char digitGroupSeparator)

Parameters

value short

The number to append.

digitGroupSeparator char

The character to use for separating digit groups.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendHexadecimal(int)

Appends an integer as a hexadecimal value.

public StringMakerHandle AppendHexadecimal(int value)

Parameters

value int

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendHexadecimal(int, char)

Appends an integer as a hexadecimal value.

public StringMakerHandle AppendHexadecimal(int value, char digitGroupSeparator)

Parameters

value int

The number to append.

digitGroupSeparator char

The character to use for separating digit groups.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendHexadecimal(long)

Appends a long integer as a hexadecimal value.

public StringMakerHandle AppendHexadecimal(long value)

Parameters

value long

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendHexadecimal(long, char)

Appends a long integer as a hexadecimal value.

public StringMakerHandle AppendHexadecimal(long value, char digitGroupSeparator)

Parameters

value long

The number to append.

digitGroupSeparator char

The character to use for separating digit groups.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendHexadecimal(sbyte)

Appends a signed byte as a hexadecimal value.

public StringMakerHandle AppendHexadecimal(sbyte value)

Parameters

value sbyte

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendHexadecimal(ushort)

Appends an unsigned short integer as a hexadecimal value.

public StringMakerHandle AppendHexadecimal(ushort value)

Parameters

value ushort

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendHexadecimal(ushort, char)

Appends an unsigned short integer as a hexadecimal value.

public StringMakerHandle AppendHexadecimal(ushort value, char digitGroupSeparator)

Parameters

value ushort

The number to append.

digitGroupSeparator char

The character to use for separating digit groups.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendHexadecimal(uint)

Appends an unsigned integer.

public StringMakerHandle AppendHexadecimal(uint value)

Parameters

value uint

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendHexadecimal(uint, char)

Appends an unsigned integer as a hexadecimal value.

public StringMakerHandle AppendHexadecimal(uint value, char digitGroupSeparator)

Parameters

value uint

The number to append.

digitGroupSeparator char

The character to use for separating digit groups.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendHexadecimal(ulong)

Appends an unsigned long integer as a hexadecimal value.

public StringMakerHandle AppendHexadecimal(ulong value)

Parameters

value ulong

The number to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

AppendHexadecimal(ulong, char)

Appends an unsigned long integer as a hexadecimal value.

public StringMakerHandle AppendHexadecimal(ulong value, char digitGroupSeparator)

Parameters

value ulong

The number to append.

digitGroupSeparator char

The character to use for separating digit groups.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Clear()

Sets the Length to zero.

public StringMakerHandle Clear()

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Clear(FloatFormatInfo)

Sets the Length to zero, and sets the NumberFormat.

public StringMakerHandle Clear(FloatFormatInfo numberFormat)

Parameters

numberFormat FloatFormatInfo

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

ConvertToUTF8(Span<byte>)

Converts the contents of the instance to a UTF-8 byte Span<T>.

public int ConvertToUTF8(Span<byte> target)

Parameters

target Span<byte>

The target byte Span<T> to which the conversion will be copied.

Returns

int

The number of bytes copied to the target.

Exceptions

ArgumentException

Thrown if the target length is not enough to hold the encoded data.

CopyTo(Span<char>)

Copies the contents of the instance to a character Span<T>.

public void CopyTo(Span<char> target)

Parameters

target Span<char>

Exceptions

ArgumentException

Thrown if the target length is less than this StringMaker Length.

Equals(StringMaker)

Compares the characters of two StringMaker instances up to the current Length.

public bool Equals(StringMaker stringMaker)

Parameters

stringMaker StringMaker

The other StringMaker to compare.

Returns

bool

Return true if both have equal length and equal character values up to the current Length.

Equals(StringMakerHandle)

Compares the characters of two StringMaker instances up to the current Length.

public bool Equals(StringMakerHandle stringMakerHandle)

Parameters

stringMakerHandle StringMakerHandle

The other StringMaker to compare.

Returns

bool

Return true if both have equal length and equal character values up to the current Length.

Equals(ReadOnlySpan<char>)

Compares the characters of a StringMaker to a ReadOnlySpan of char up to the current Length.

public bool Equals(ReadOnlySpan<char> span)

Parameters

span ReadOnlySpan<char>

The other StringMaker to compare.

Returns

bool

Return true if both have equal length and equal character values up to the current Length.

ForEachArray<T>(T, ForEachArrayAction<T>)

Invokes a StringMaker.ForEachArrayAction<TArg> for each character array in the StringMaker.

public void ForEachArray<T>(T arg, StringMaker.ForEachArrayAction<T> action)

Parameters

arg T

The argument to pass into the action.

action StringMaker.ForEachArrayAction<T>

The action to invoke.

Type Parameters

T

The type of argument to be passed into the action.

ReleaseMemory()

Clears and releases excess character arrays to the shared pool, and sets the null '\0' character from the Length index to the end of the last remaining character array.

public StringMakerHandle ReleaseMemory()

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

Reset()

Sets the Length to zero, and clear the NumberFormat.

public StringMakerHandle Reset()

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

ToString()

Allocates a new string and copies the contents of the StringMaker.

public override string ToString()

Returns

string

The new string.

Operators

operator +(StringMakerHandle, bool)

Appends a value.

public static StringMakerHandle operator +(StringMakerHandle stringMakerHandle, bool value)

Parameters

stringMakerHandle StringMakerHandle

The StringMakerHandle to append.

value bool

The value to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

operator +(StringMakerHandle, char)

Appends a value.

public static StringMakerHandle operator +(StringMakerHandle stringMakerHandle, char value)

Parameters

stringMakerHandle StringMakerHandle

The StringMakerHandle to append.

value char

The value to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

operator +(StringMakerHandle, DateTime)

Appends a value.

public static StringMakerHandle operator +(StringMakerHandle stringMakerHandle, DateTime value)

Parameters

stringMakerHandle StringMakerHandle

The StringMakerHandle to append.

value DateTime

The value to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

operator +(StringMakerHandle, double)

Appends a value.

public static StringMakerHandle operator +(StringMakerHandle stringMakerHandle, double value)

Parameters

stringMakerHandle StringMakerHandle

The StringMakerHandle to append.

value double

The value to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

operator +(StringMakerHandle, long)

Appends a long integer.

public static StringMakerHandle operator +(StringMakerHandle stringMakerHandle, long value)

Parameters

stringMakerHandle StringMakerHandle

The StringMakerHandle to append.

value long

The value to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

operator +(StringMakerHandle, ReadOnlySpan<char>)

Appends a value.

public static StringMakerHandle operator +(StringMakerHandle stringMakerHandle, ReadOnlySpan<char> value)

Parameters

stringMakerHandle StringMakerHandle

The StringMakerHandle to append.

value ReadOnlySpan<char>

The value to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.

operator +(StringMakerHandle, ulong)

Appends a value.

public static StringMakerHandle operator +(StringMakerHandle stringMakerHandle, ulong value)

Parameters

stringMakerHandle StringMakerHandle

The StringMaker to append.

value ulong

The value to append.

Returns

StringMakerHandle

Returns the instance, enabling a fluent interface.