Saturday, 2 December 2017

C# Program to Illustrate StringBuilder


Code:

using System;
using System.Text;
class Program
{
    static void Main()
    {
        StringBuilder bd = new StringBuilder();
        bd.Append("1 ");
        bd.Append("2 ");
        bd.Append("3 ");
        for (int i = 0; i < 5; i++)
        {
            bd.Append("z ");
        }
        string result = bd.ToString();
        Console.WriteLine(result);
        Console.ReadLine();
    }
}


Output:

1 2 3 z z z z z


More C# Programs:

















100+ Best Home Decoration Ideas For Christmas Day 2019 To Make Home Beautiful

Best gifts for Christmas Day | Greeting cards for Christmas Day | Gift your children a new gift on Christmas day This Christmas d...