C# StringBuilder Append(String)

Description

StringBuilder Append(String) Appends a copy of the specified string to this instance.

Syntax

StringBuilder.Append(String) has the following syntax.


public StringBuilder Append(
  string value
)

Parameters

StringBuilder.Append(String) has the following parameters.

  • value - The string to append.

Returns

StringBuilder.Append(String) method returns A reference to this instance after the append operation has completed.

Example


using System;/*from www.ja  v  a 2  s .c  o  m*/
using System.Text;
using System.Globalization;

class Sample 
{
    public static void Main() 
    {
        bool flag = false;
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        sb.Append("The value of the flag is ").Append(flag).Append(".");
        Console.WriteLine(sb.ToString());
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Text »




ASCIIEncoding
Encoding
EncodingInfo
StringBuilder
UnicodeEncoding
UTF8Encoding