Maha

Maha

  • NA
  • 0
  • 328.1k

StringBuilder

Jul 18 2013 8:19 AM
This incomplete program is given in the following website:
http://www.dotnetperls.com/stringbuilder

What is the meaning of "Get a reference to the StringBuilder's buffer content."
And what is use of Debug.WriteLine(innerString);.

Problem is highlighted

using System;
using System.Text;
using System.Diagnostics;

class Program
{
static void Main()
{
// 1.
// Declare a new StringBuilder.
StringBuilder builder = new StringBuilder();

// 2.
builder.Append("The list starts here:");

// 3.
builder.AppendLine();

// 4.
builder.Append("1 cat").AppendLine();

// 5.
// Get a reference to the StringBuilder's buffer content.
string innerString = builder.ToString();

// Display with Debug.
Debug.WriteLine(innerString);

Console.ReadKey();
}


Answers (4)