Class TextBuilderDC
- Assembly
- SunamoDevCode.dll
Text builder that supports building strings using either a StringBuilder or a List of lines, with optional undo functionality.
public class TextBuilderDC
- Inheritance
-
TextBuilderDC
- Inherited Members
- Extension Methods
Constructors
TextBuilderDC(bool)
Initializes a new TextBuilderDC using either a list or StringBuilder based on the parameter.
public TextBuilderDC(bool useList = false)
Parameters
useListboolIf true, uses a list of lines instead of StringBuilder.
Fields
stringBuilder
The underlying StringBuilder used when not in list mode.
public StringBuilder stringBuilder
Field Value
Properties
CanUndo
Gets or sets whether undo is enabled. Setting to false clears the undo state.
public bool CanUndo { get; set; }
Property Value
list
Gets or sets the list used for line-based building when in list mode.
public List<string> list { get; set; }
Property Value
prependEveryNoWhite
Gets or sets text to prepend before every non-whitespace append operation.
public string prependEveryNoWhite { get; set; }
Property Value
Methods
Append(object)
Appends the string representation of an object.
public void Append(object text)
Parameters
textobjectObject whose string representation to append.
Append(string)
Appends text to the current line or to the StringBuilder.
public void Append(string text)
Parameters
textstringText to append.
AppendLine()
Appends a new line to the output.
public void AppendLine()
AppendLine(string)
Appends text followed by a new line.
public void AppendLine(string text)
Parameters
textstringText to append before the new line.
Clear()
Clears all accumulated text or lines.
public void Clear()
Create(bool)
Creates a new TextBuilderDC instance with the specified mode.
public static TextBuilderDC Create(bool useList = false)
Parameters
useListboolIf true, uses a list of lines instead of StringBuilder.
Returns
- TextBuilderDC
A new TextBuilderDC instance.
ToString()
Returns the accumulated text as a single string.
public override string ToString()
Returns
- string
All accumulated text joined together.
Undo()
Undoes the last append operation by removing the last appended text from the StringBuilder.
public void Undo()