How to Join Two Strings in C#/CSharp

To join strings in C#/CSharp, we make use of Concat method.  Example is given below.

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
using System;
namespace Hello_World
{
class Program
{
static void Main(string[] args)
{
string hello = "Hello ";
string world = " World!";
string final = string.Concat(hello, world);
Console.WriteLine(final);
}
}
}
using System; namespace Hello_World { class Program { static void Main(string[] args) { string hello = "Hello "; string world = " World!"; string final = string.Concat(hello, world); Console.WriteLine(final); } } }
using System;

namespace Hello_World
{

    class Program
    {
        static void Main(string[] args)
        {
            string hello = "Hello ";
            string world = " World!";

            string final = string.Concat(hello, world);

            Console.WriteLine(final);
        }
    }
}