Table of Contents

Struct SwiftThrowInterpolatedStringHandler

Namespace
SwiftCollections.Diagnostics
Assembly
SwiftCollections.dll

Builds exception messages only when the guarded throw condition is true.

public ref struct SwiftThrowInterpolatedStringHandler
Inherited Members

Constructors

SwiftThrowInterpolatedStringHandler(int, int, bool, out bool)

Initializes a new instance of the SwiftThrowInterpolatedStringHandler struct.

public SwiftThrowInterpolatedStringHandler(int literalLength, int formattedCount, bool condition, out bool isEnabled)

Parameters

literalLength int

The combined length of literal portions in the interpolated string.

formattedCount int

The number of formatted expressions in the interpolated string.

condition bool

The throw condition that controls whether formatting occurs.

isEnabled bool

Set to true when formatted expressions should be evaluated.

Properties

IsEnabled

Gets whether this handler is actively building an exception message.

public bool IsEnabled { get; }

Property Value

bool

Methods

AppendFormatted(ReadOnlySpan<char>)

Appends a character span.

public void AppendFormatted(ReadOnlySpan<char> value)

Parameters

value ReadOnlySpan<char>

The span to append.

AppendFormatted(ReadOnlySpan<char>, int)

Appends a character span with the specified alignment.

public void AppendFormatted(ReadOnlySpan<char> value, int alignment)

Parameters

value ReadOnlySpan<char>

The span to append.

alignment int

The minimum width for the formatted value.

AppendFormatted(ReadOnlySpan<char>, int, string?)

Appends a character span with the specified alignment and format string.

public void AppendFormatted(ReadOnlySpan<char> value, int alignment, string? format)

Parameters

value ReadOnlySpan<char>

The span to append.

alignment int

The minimum width for the formatted value.

format string

The format string to apply.

AppendFormatted(string?)

Appends a string value.

public void AppendFormatted(string? value)

Parameters

value string

The value to append.

AppendFormatted(string?, int)

Appends a string value with the specified alignment.

public void AppendFormatted(string? value, int alignment)

Parameters

value string

The value to append.

alignment int

The minimum width for the formatted value.

AppendFormatted(string?, int, string?)

Appends a string value with the specified alignment and format string.

public void AppendFormatted(string? value, int alignment, string? format)

Parameters

value string

The value to append.

alignment int

The minimum width for the formatted value.

format string

The format string to apply.

AppendFormatted<T>(T)

Appends a formatted value.

public void AppendFormatted<T>(T value)

Parameters

value T

The value to append.

Type Parameters

T

The type of value to append.

AppendFormatted<T>(T, int)

Appends a formatted value with the specified alignment.

public void AppendFormatted<T>(T value, int alignment)

Parameters

value T

The value to append.

alignment int

The minimum width for the formatted value.

Type Parameters

T

The type of value to append.

AppendFormatted<T>(T, int, string?)

Appends a formatted value with the specified alignment and format string.

public void AppendFormatted<T>(T value, int alignment, string? format)

Parameters

value T

The value to append.

alignment int

The minimum width for the formatted value.

format string

The format string to apply.

Type Parameters

T

The type of value to append.

AppendFormatted<T>(T, string?)

Appends a formatted value using the specified format string.

public void AppendFormatted<T>(T value, string? format)

Parameters

value T

The value to append.

format string

The format string to apply.

Type Parameters

T

The type of value to append.

AppendLiteral(string)

Appends a literal string segment.

public void AppendLiteral(string value)

Parameters

value string

The literal string segment.