Class AppendOnlyBuilder

A very simple implementatino of a StringBuilder that only supports Append operations. It outperforms the regular System.Text.StringBuilder in the Append-only scenario.

Inheritance
System.Object
AppendOnlyBuilder
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Core.Html
Assembly: EPiServer.dll
Version: 8.11.0
Syntax
public class AppendOnlyBuilder

Constructors

AppendOnlyBuilder()

Initializes a new instance of the AppendOnlyBuilder class.

Declaration
public AppendOnlyBuilder()

AppendOnlyBuilder(Int32)

Initializes a new instance of the AppendOnlyBuilder class.

Declaration
public AppendOnlyBuilder(int initialCapacity)
Parameters
Type Name Description
System.Int32 initialCapacity

The initial capacity of the builder.

Properties

LastChar

Gets the last character added to this instance.

Declaration
public char LastChar { get; }
Property Value
Type Description
System.Char

The last character.

Remarks

If the instance is empty (Length is 0), character with value 0 is returned.

Length

Gets or sets the length of the builder.

Declaration
public int Length { get; set; }
Property Value
Type Description
System.Int32

The length.

Remarks

It is cheaper re-use an existing instance, by setting the Length to 0, than to create a new AppendOnlyBuilder instance.

Methods

Append(Char)

Appends the specified character to the builder.

Declaration
public AppendOnlyBuilder Append(char ch)
Parameters
Type Name Description
System.Char ch

The character to append.

Returns
Type Description
AppendOnlyBuilder

The current AppendOnlyBuilder instance.

Append(String)

Appends the specified string to the builder.

Declaration
public AppendOnlyBuilder Append(string s)
Parameters
Type Name Description
System.String s

The string to append.

Returns
Type Description
AppendOnlyBuilder

The current AppendOnlyBuilder instance.

ToString()

Returns a System.String that represents the current System.Object.

Declaration
public override string ToString()
Returns
Type Description
System.String

A System.String that represents the current System.Object.

Overrides
System.Object.ToString()

Extension Methods