Table of Contents

Class TextBuilderPS

Namespace
SunamoPS._public
Assembly
SunamoPS.dll

Text builder that supports both StringBuilder and List-based modes for constructing PowerShell commands.

public class TextBuilderPS
Inheritance
TextBuilderPS
Inherited Members
Extension Methods

Constructors

TextBuilderPS(bool)

Initializes a new instance of TextBuilderPS.

public TextBuilderPS(bool isUsingList = false)

Parameters

isUsingList bool

Whether to use list mode instead of StringBuilder mode.

Properties

CanUndo

Gets or sets whether undo is enabled. When disabled, resets undo state.

public bool CanUndo { get; set; }

Property Value

bool

List

Gets or sets the list of command strings. Used in list mode.

public List<string>? List { get; set; }

Property Value

List<string>

PrependEveryNoWhite

Gets or sets the text to prepend before every non-whitespace append.

public string PrependEveryNoWhite { get; set; }

Property Value

string

StringBuilder

Gets or sets the underlying StringBuilder instance. Null when using list mode.

public StringBuilder? StringBuilder { get; set; }

Property Value

StringBuilder

Methods

Append(object)

Appends an object's string representation.

public void Append(object value)

Parameters

value object

Object to append.

Append(string)

Appends text without a trailing newline.

public void Append(string text)

Parameters

text string

Text to append.

AppendLine()

Appends a newline.

public void AppendLine()

AppendLine(string)

Appends text followed by a newline.

public void AppendLine(string text)

Parameters

text string

Text to append as a line.

Clear()

Clears all accumulated content.

public void Clear()

Create(bool)

Creates a new TextBuilderPS instance.

public static TextBuilderPS Create(bool isUsingList = false)

Parameters

isUsingList bool

Whether to use list mode instead of StringBuilder mode.

Returns

TextBuilderPS

New TextBuilderPS instance.

ToString()

Returns the accumulated text as a string.

public override string ToString()

Returns

string

String representation of accumulated content.

Undo()

Undoes the last append operation. Only supported in StringBuilder mode.

public void Undo()