FormatterOptions Class

Configures assertion failure formatting.

public sealed class FormatterOptions

Constructors

NameDescription
FormatterOptions()

FormatterOptions()

FormatterOptions.cs
public FormatterOptions()

No documentation is available.

Properties

NameDescription
HighlightedContextItemCountGets or sets the number of neighboring items to format before and after a highlighted item in focused mode.
MaxFormattedItemsGets or sets the number of items to format from the start of an enumerable before truncating it.
MaxFormattedStringLengthGets or sets the maximum number of characters of a string to format before truncating it.
PrefixItemCountGets or sets the number of items to keep from the start of an enumerable when a highlighted item is outside the leading range.
SuffixItemCountGets or sets the minimum number of items to format after a highlighted item in the leading range.

HighlightedContextItemCount

FormatterOptions.cs

Gets or sets the number of neighboring items to format before and after a highlighted item in focused mode.

public int HighlightedContextItemCount { get; set; }

Property value

int

Remarks

This value is used only when the highlighted item index is greater than or equal to FormatterOptions.MaxFormattedItems. The formatter then writes FormatterOptions.PrefixItemCount items from the beginning, an ellipsis when items were skipped, and up to this many items on each side of the highlighted item.

MaxFormattedItems

FormatterOptions.cs

Gets or sets the number of items to format from the start of an enumerable before truncating it.

public int MaxFormattedItems { get; set; }

Property value

int

Remarks

When there is no highlighted item, or when the highlighted item is within this leading range, the formatter writes items from the beginning of the enumerable. If FormatterOptions.SuffixItemCount requires more items after a highlighted item, the formatter can write more than this value. When the highlighted item index is greater than or equal to this value, the formatter switches to focused mode: it writes FormatterOptions.PrefixItemCount items from the beginning, an ellipsis, and a window around the highlighted item controlled by FormatterOptions.HighlightedContextItemCount.

MaxFormattedStringLength

FormatterOptions.cs

Gets or sets the maximum number of characters of a string to format before truncating it.

public int MaxFormattedStringLength { get; set; }

Property value

int

Remarks

A longer string is formatted as a window of this many characters around the highlighted character (the first difference, for instance), with an ellipsis for each truncated side and the total length of the string. Text produced by Object.ToString is truncated to this many characters too.

PrefixItemCount

FormatterOptions.cs

Gets or sets the number of items to keep from the start of an enumerable when a highlighted item is outside the leading range.

public int PrefixItemCount { get; set; }

Property value

int

Remarks

This value is used only in focused mode, when the highlighted item index is greater than or equal to FormatterOptions.MaxFormattedItems. It preserves the beginning of the enumerable before the ellipsis and the highlighted-item context window.

SuffixItemCount

FormatterOptions.cs

Gets or sets the minimum number of items to format after a highlighted item in the leading range.

public int SuffixItemCount { get; set; }

Property value

int

Remarks

This value is used when the highlighted item index is less than FormatterOptions.MaxFormattedItems. In that case, the formatter writes at least FormatterOptions.MaxFormattedItems items, and can continue up to the highlighted item plus this many following items. This lets assertion failures found near the beginning of a snapshot show extra items after the difference.