Click or drag to resize
DigitalRuneStringBuilderExtensions Class
Static class for string builder extension methods.
Inheritance Hierarchy
SystemObject
  DigitalRune.TextStringBuilderExtensions

Namespace: DigitalRune.Text
Assembly: DigitalRune (in DigitalRune.dll) Version: 1.20.0.0 (1.20.1.14552)
Syntax
public static class StringBuilderExtensions

The StringBuilderExtensions type exposes the following members.

Methods
  NameDescription
Public methodStatic memberAppend
Appends a copy of a string builder to the end of the string builder.
Public methodStatic memberAppendNumber(StringBuilder, Int32)
Converts an integer number to a string and adds it to string builder.
Public methodStatic memberAppendNumber(StringBuilder, Single)
Converts a float number to a string and adds it to the string builder.
Public methodStatic memberAppendNumber(StringBuilder, Int32, AppendNumberOptions)
Converts an integer number to a string and adds it to the string builder.
Public methodStatic memberAppendNumber(StringBuilder, Single, AppendNumberOptions)
Converts a float number to a string and adds it to the string builder.
Public methodStatic memberAppendNumber(StringBuilder, Single, Int32, AppendNumberOptions)
Converts a float number to a string and adds it to the string builder.
Top
Remarks

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.

Examples
The following sample demonstrates how to append a number to a StringBuilder using one of the extension methods defined in this class.
C#
stringBuilder.AppendNumber(12345);
See Also