Saturday, 2 April 2016

How To append String in C sharp program

using System;
using System.Text;

public class StringProgram
{
    static void Main()
       {
        StringBuilder sb = new StringBuilder();

        sb.Append("I ").Append("Love ").Append("My... ");

        string built1 = sb.ToString();

        sb.Append("India");

        string built2 = sb.ToString();

        Console.WriteLine( built1 );
        Console.WriteLine( built2 );
    }
}
------------------------------
OUTPUT:-

I Love My...
I Love My... India
-----------------------------------------------------

No comments:

Post a Comment