Windows apps
Collapse the table of content
Expand the table of content
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

String.Join Method (String, String[])

Updated: January 2011

Concatenates a specified separator String between each element of a specified String array, yielding a single concatenated string.

Namespace:  System
Assembly:  mscorlib (in mscorlib.dll)

public static string Join(
	string separator,
	params string[] value


Type: System.String
The string to use as a separator.
Type: System.String[]
An array that contains the elements to concatenate.

Return Value

Type: System.String
A string that consists of the elements in value delimited by the separator string. If value is an empty array, the method returns String.Empty.


value is null.

For example if separator is ", " and the elements of value are "apple", "orange", "grape", and "pear", Join(separator, value) returns "apple, orange, grape, pear".

If separator is null, an empty string (Empty) is used instead. If any element in value is null, an empty string is used instead.

The following example demonstrates the Join method.

using System;

public class Example
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)

      outputBlock.Text += String.Format(MakeLine(0, 5, ", ")) + "\n";
      outputBlock.Text += String.Format(MakeLine(1, 6, "  ")) + "\n";
      outputBlock.Text += String.Format(MakeLine(9, 9, ": ")) + "\n";
      outputBlock.Text += String.Format(MakeLine(4, 7, "< ")) + "\n";

   private static string MakeLine(int initVal, int multVal, string sep)

      string[] sArr = new string[10];

      for (int i = initVal; i < initVal + 10; i++)
         sArr[i - initVal] = String.Format("{0,-3}", i * multVal);

      return String.Join(sep, sArr);


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.




January 2011

Noted that an empty string is substituted for any null element in the array.

Customer feedback.

Community Additions

© 2017 Microsoft