February 11, 2016
How to Join Two Strings in C#/CSharp
To join strings in C#/CSharp, we make use of Concat method. Example is given below.
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); } } }