4
Answers

StringBuilder

Ask a question
Maha

Maha

11y
1.3k
1
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)