Skip to content
ConsoleMonster
Class

StyledLine

ConsoleMonster.Text

Namespace
ConsoleMonster.Text
Assembly
ConsoleMonster
Implements
IReadOnlyList<TextSpan> IReadOnlyCollection<TextSpan> IEnumerable<TextSpan> IEnumerable
Modifiers
sealed
Attributes
DefaultMember("Item")

One line of styled spans (no line breaks). Immutable once created.

Inheritance

  • object
  • StyledLine

Usage

Explore 36 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Accepted by parameters 16

Constructors

public StyledLine(IEnumerable<TextSpan> spans) #

Creates a line from spans. Line breaks inside spans are replaced with spaces.

Parameters

spans System.Collections.Generic.IEnumerable<ConsoleMonster.Text.TextSpan> required
The spans.

Methods

public static StyledLine From(string text, Style style = default) #

Creates a single-span line.

Parameters

text string required
The text.
style ConsoleMonster.Styling.Style = default optional
The style.

Returns

StyledLine The line.
public IEnumerator<TextSpan> GetEnumerator() #

Returns an enumerator that iterates through the collection.

Returns

IEnumerator<TextSpan> An enumerator that can be used to iterate through the collection.
public override string ToString() #

Returns a string that represents the current object.

Returns

string A string that represents the current object.
public StyledLine WithBaseStyle(Style baseStyle) #

Returns a copy with baseStyle layered under every span.

Parameters

baseStyle ConsoleMonster.Styling.Style required
The style underneath.

Returns

StyledLine A new line.

Properties

public static StyledLine Empty { get; } #

An empty line.

public int Count { get; } #

Gets the number of elements in the collection.

public TextSpan this[int index] { get; } #

Gets the element at the specified index in the read-only list.

Parameters

index int required
The zero-based index of the element to get.
public int Width { get; } #

Display width in cells.

public string PlainText { get; } #

The text without styles.