Make String using StringBuilder - CSharp Language Basics

CSharp examples for Language Basics:StringBuilder

Description

Make String using StringBuilder

Demo Code

using System;//from   ww  w .j  ava 2s .c  o  m
using System.Text;
class StringMaker
{
   public static void Main()
   {
      string finalFairyTale;
      StringBuilder fairyTaleBeingWritten = new StringBuilder("Once upon a time");
      fairyTaleBeingWritten.Append(" a beautiful princess");
      fairyTaleBeingWritten.Append(" lived in a big castle");
      finalFairyTale = fairyTaleBeingWritten.ToString();
      Console.WriteLine(finalFairyTale);
   }
}

Result


Related Tutorials