Export (0) Print
Expand All

String.Join Method (String, String[])

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

ExceptionCondition
ArgumentNullException

value is a null reference (Nothing in Visual Basic).

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 a null reference (Nothing in Visual Basic), an empty string (String.Empty) is used instead. If any element in value is a null reference (Nothing in Visual Basic), 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.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft