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
Namespace: EPiServer.Core.Html
Assembly: EPiServer.Cms.AspNetCore.dll
Version: 12.0.3Syntax
public class AppendOnlyBuilder : Object
Constructors
AppendOnlyBuilder()
Initializes a new instance of the Append
Declaration
public AppendOnlyBuilder()
AppendOnlyBuilder(Int32)
Initializes a new instance of the Append
Declaration
public AppendOnlyBuilder(int initialCapacity)
Parameters
Type | Name | Description |
---|---|---|
System. |
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. |
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. |
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. |
ch | The character to append. |
Returns
Type | Description |
---|---|
Append |
The current AppendOnlyBuilder instance. |
Append(String)
Appends the specified string to the builder.
Declaration
public AppendOnlyBuilder Append(string s)
Parameters
Type | Name | Description |
---|---|---|
System. |
s | The string to append. |
Returns
Type | Description |
---|---|
Append |
The current AppendOnlyBuilder instance. |
ToString()
Returns a System.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System. |
A System. |