This post will discuss how to concatenate strings in C#.

1. String concatenation using (+)

String concatenation in C# is done using the + operator. We can use this for concatenating two or three strings.

Download  Run Code

2. Using String.Concat() method

A simple and fairly efficient solution to concatenate two or more strings using the String.Concat() method.

Download  Run Code

3. Using StringBuilder.Append() method

StringBuilder.Append method can be used to append multiple strings effectively. This is a preferred solution over the + operator for concatenating more than three strings.

Download  Run Code

4. Using String.Join() method

The following code example demonstrates how to use the String.Join() method for concatenating multiple strings using an empty string as a separator.

Download  Run Code

5. Using String.Format() method

One can use String.Format() method for concatenating multiple strings with one another, as shown below:

Download  Run Code

6. String Interpolation

Starting with C# 6, one can use String interpolation ($), which provides a convenient syntax for converting an integer to a string.

Download  Run Code

That’s all about concatenating strings in C#.