StringBuilderExtensions Class |
Namespace: DigitalRune.Text
The StringBuilderExtensions type exposes the following members.
Name | Description | |
---|---|---|
Append |
Appends a copy of a string builder to the end of the string builder.
| |
AppendNumber(StringBuilder, Int32) |
Converts an integer number to a string and adds it to string builder.
| |
AppendNumber(StringBuilder, Single) |
Converts a float number to a string and adds it to the string builder.
| |
AppendNumber(StringBuilder, Int32, AppendNumberOptions) |
Converts an integer number to a string and adds it to the string builder.
| |
AppendNumber(StringBuilder, Single, AppendNumberOptions) |
Converts a float number to a string and adds it to the string builder.
| |
AppendNumber(StringBuilder, Single, Int32, AppendNumberOptions) |
Converts a float number to a string and adds it to the string builder.
|
You can use a StringBuilder to avoid unwanted memory allocations. But there are still problems for adding numerical values to StringBuilder. One of them is boxing that occurs when you use the AppendFormat(String, Object) method. Another issue is memory allocation that occurs when you specify int or float for the Append(Single) method.
This class provides solution for those issue. All methods are defined as extension methods for StringBuilder. So, you can use those methods like below.
stringBuilder.AppendNumber(12345);