C# StringBuilder Length

Description

StringBuilder Length Gets or sets the length of the current StringBuilder object.

Syntax

StringBuilder.Length has the following syntax.


public int Length { get; set; }

Example

The following example demonstrates the Length property.


/*ww w .j  a v  a2 s  .c o  m*/
using System;
using System.Text;

class Sample 
{
    public static void Main() 
    {
        StringBuilder sb1 = new StringBuilder("abc");
        Console.WriteLine(sb1.Length);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System.Text »




ASCIIEncoding
Encoding
EncodingInfo
StringBuilder
UnicodeEncoding
UTF8Encoding