How to concatenate two strings in C#

Concatenation is the process of appending one string to the end of another. In C#, any two strings can be concatenated using the + operator.

svg viewer

Code

The code snippet below illustrates the process of concatenating two strings in C#:

class HelloWorld
{
static void Main()
{
string FirstString = "Hello";
string SecondString = "World";
string ConcatenatedString = FirstString + SecondString;
System.Console.WriteLine(ConcatenatedString);
}
}
Copyright ©2024 Educative, Inc. All rights reserved