Edit

Share via


StringBuilder.Append Method

Definition

Appends the string representation of a specified object to this instance.

Overloads

Name Description
Append(StringBuilder)

Appends the string representation of a specified string builder to this instance.

Append(StringBuilder+AppendInterpolatedStringHandler)

Appends the specified interpolated string to this instance.

Append(UInt16)

Appends the string representation of a specified 16-bit unsigned integer to this instance.

Append(UInt32)

Appends the string representation of a specified 32-bit unsigned integer to this instance.

Append(Char, Int32)

Appends a specified number of copies of the string representation of a Unicode character to this instance.

Append(Char[], Int32, Int32)

Appends the string representation of a specified subarray of Unicode characters to this instance.

Append(IFormatProvider, StringBuilder+AppendInterpolatedStringHandler)

Appends the specified interpolated string to this instance using the specified format.

Append(String)

Appends a copy of the specified string to this instance.

Append(String, Int32, Int32)

Appends a copy of a specified substring to this instance.

Append(StringBuilder, Int32, Int32)

Appends a copy of a substring within a specified string builder to this instance.

Append(Char*, Int32)

Appends an array of Unicode characters starting at a specified address to this instance.

Append(Single)

Appends the string representation of a specified single-precision floating-point number to this instance.

Append(UInt64)

Appends the string representation of a specified 64-bit unsigned integer to this instance.

Append(ReadOnlySpan<Char>)

Appends the string representation of a specified read-only character span to this instance.

Append(SByte)

Appends the string representation of a specified 8-bit signed integer to this instance.

Append(Boolean)

Appends the string representation of a specified Boolean value to this instance.

Append(Byte)

Appends the string representation of a specified 8-bit unsigned integer to this instance.

Append(Char)

Appends the string representation of a specified Char object to this instance.

Append(Decimal)

Appends the string representation of a specified decimal number to this instance.

Append(Double)

Appends the string representation of a specified double-precision floating-point number to this instance.

Append(Char[])

Appends the string representation of the Unicode characters in a specified array to this instance.

Append(Int16)

Appends the string representation of a specified 16-bit signed integer to this instance.

Append(Int32)

Appends the string representation of a specified 32-bit signed integer to this instance.

Append(Int64)

Appends the string representation of a specified 64-bit signed integer to this instance.

Append(Object)

Appends the string representation of a specified object to this instance.

Append(ReadOnlyMemory<Char>)

Appends the string representation of a specified read-only character memory region to this instance.

Append(StringBuilder)

Source:
StringBuilder.cs
Source:
StringBuilder.cs
Source:
StringBuilder.cs
Source:
StringBuilder.cs

Appends the string representation of a specified string builder to this instance.

public:
 System::Text::StringBuilder ^ Append(System::Text::StringBuilder ^ value);
public System.Text.StringBuilder Append(System.Text.StringBuilder? value);
public System.Text.StringBuilder Append(System.Text.StringBuilder value);
member this.Append : System.Text.StringBuilder -> System.Text.StringBuilder
Public Function Append (value As StringBuilder) As StringBuilder

Parameters

value
StringBuilder

The string builder to append.

Returns

A reference to this instance after the append operation is completed.

Applies to

Append(StringBuilder+AppendInterpolatedStringHandler)

Source:
StringBuilder.cs
Source:
StringBuilder.cs
Source:
StringBuilder.cs
Source:
StringBuilder.cs

Appends the specified interpolated string to this instance.

public:
 System::Text::StringBuilder ^ Append(System::Text::StringBuilder::AppendInterpolatedStringHandler % handler);
public System.Text.StringBuilder Append(ref System.Text.StringBuilder.AppendInterpolatedStringHandler handler);
member this.Append : AppendInterpolatedStringHandler -> System.Text.StringBuilder
Public Function Append (ByRef handler As StringBuilder.AppendInterpolatedStringHandler) As StringBuilder

Parameters

handler
StringBuilder.AppendInterpolatedStringHandler

The interpolated string to append.

Returns

A reference to this instance after the append operation has completed.

Applies to

Append(UInt16)

Source:
StringBuilder.cs
Source:
StringBuilder.cs
Source:
StringBuilder.cs
Source:
StringBuilder.cs

Important

This API is not CLS-compliant.

Appends the string representation of a specified 16-bit unsigned integer to this instance.

public:
 System::Text::StringBuilder ^ Append(System::UInt16 value);
[System.CLSCompliant(false)]
public System.Text.StringBuilder Append(ushort value);
[<System.CLSCompliant(false)>]
member this.Append : uint16 -> System.Text.StringBuilder
Public Function Append (value As UShort) As StringBuilder

Parameters

value
UInt16

The value to append.

Returns

A reference to this instance after the append operation has completed.

Attributes

Exceptions

Enlarging the value of this instance would exceed MaxCapacity.

Remarks

The Append(UInt16) method modifies the existing instance of this class; it does not return a new class instance. Because of this, you can call a method or property on the existing reference and you do not have to assign the return value to a StringBuilder object, as the following example illustrates.

System.Text.StringBuilder sb = new 
            System.Text.StringBuilder("The range of a 16-bit unsigned integer: ");
sb.Append(UInt16.MinValue).Append(" to ").Append(UInt16.MaxValue);
Console.WriteLine(sb);
// The example displays the following output:
//       The range of a 16-bit unsigned integer: 0 to 65535
let sb = StringBuilder "The range of a 16-bit unsigned integer: "
sb.Append(UInt16.MinValue).Append(" to ").Append UInt16.MaxValue |> ignore
printfn $"{sb}"
// The example displays the following output:
//       The range of a 16-bit unsigned integer: 0 to 65535
Dim sb As New System.Text.StringBuilder("The range of a 16-bit unsigned integer: ")
sb.Append(UInt16.MinValue).Append(" to ").Append(UInt16.MaxValue)
Console.WriteLine(sb)
' The example displays the following output:
'       The range of a 16-bit unsigned integer: 0 to 65535

The Append(UInt16) method calls the