How to concatenate strings using StringBuilder in C#

1 Answer

0 votes
using System;
using System.Text;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Main(string[] args)
        {
            string s1 = "c#";
            string s2 = "modern";
            string s3 = "programming";

            string s = new StringBuilder(s1).Append(" ").Append(s2).Append(" ").Append(s3).ToString();

            Console.WriteLine(s);
        }
    }
}


/*
run:
     
c# modern programming
 
*/

 



answered Dec 22, 2016 by avibootz

Related questions

1 answer 155 views
1 answer 176 views
1 answer 191 views
191 views asked Dec 22, 2016 by avibootz
1 answer 177 views
1 answer 165 views
1 answer 185 views
...