String.Join Method (String, String[])

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

Concatenates all the elements of a string array, using the specified separator between each element.

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

static member Join : 
        separator:string *
        [<ParamArrayAttribute>] value:string[] -> string

Parameters

separator
Type: System.String

The string to use as a separator. separator is included in the returned string only if value has more than one element.

value
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.

Exception Condition
ArgumentNullException

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 (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.

No code example is currently available or this language may not be supported.

Universal Windows Platform
Available since 8
.NET Framework
Available since 1.1
Portable Class Library
Supported in: portable .NET platforms
Silverlight
Available since 2.0
Windows Phone Silverlight
Available since 7.0
Windows Phone
Available since 8.1
Return to top
Show: