This article illustrates the different techniques to join multiple strings with delimiter in C#.

1. Using String.Join() method

A simple solution to join multiple strings with a delimiter is using the String.Join() method. It concatenates members of the specified list with the specified separator, as shown below. Note that the String.Join() method is available with .NET 4.

Download  Run Code

2. Using StringBuilder

Before .NET 4, you can use StringBuilder to join multiple strings together with a delimiter. The idea is to iterate over the list and append each encountered element to StringBuilder separated by a delimiter.

Download  Run Code

 
The above code will append the delimiter on all items except the last. Here’s an alternative solution to achieve the same:

Download  Run Code

That’s all about joining multiple strings together with delimiter in C#.