Class TextBuilderPS
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
isUsingListboolWhether 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
List
Gets or sets the list of command strings. Used in list mode.
public List<string>? List { get; set; }
Property Value
PrependEveryNoWhite
Gets or sets the text to prepend before every non-whitespace append.
public string PrependEveryNoWhite { get; set; }
Property Value
StringBuilder
Gets or sets the underlying StringBuilder instance. Null when using list mode.
public StringBuilder? StringBuilder { get; set; }
Property Value
Methods
Append(object)
Appends an object's string representation.
public void Append(object value)
Parameters
valueobjectObject to append.
Append(string)
Appends text without a trailing newline.
public void Append(string text)
Parameters
textstringText to append.
AppendLine()
Appends a newline.
public void AppendLine()
AppendLine(string)
Appends text followed by a newline.
public void AppendLine(string text)
Parameters
textstringText 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
isUsingListboolWhether 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()