String::Join Method (String, array<Object>)
Concatenates the elements of an object array, using the specified separator between each element.
Assembly: mscorlib (in mscorlib.dll)
[ComVisibleAttribute(false)] public: static String^ Join( String^ separator, ... array<Object^>^ values )
Parameters
- separator
- Type: System::String
The string to use as a separator.
- values
- Type: array<System::Object>
An array that contains the elements to concatenate.
Return Value
Type: System::StringA string that consists of the elements of values delimited by the separator string. If values is an empty array, the method returns String::Empty.
| Exception | Condition |
|---|---|
| ArgumentNullException | values is nullptr. |
If separator is nullptr or if any element of values other than the first element is nullptr, an empty string (String::Empty) is used instead. See the Notes for Callers section if the first element of values is nullptr.
Join(String, array<Object>) is a convenience method that lets you concatenate each element in an object array without explicitly converting its elements to strings. The string representation of each object in the array is derived by calling that object's ToString method.
Notes to CallersIf the first element of values is nullptr, the Join method does not concatenate the elements in values but instead returns String::Empty. A number of workarounds for this issue are available. The easiest is to assign a value of String::Empty to the first element of the array, as the following example shows.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.