System.String.Concat Method

Concatenates the elements of a specified string array.

Syntax

public static string Concat (params string[] values)

Parameters

values
An array of string instances.

Returns

The concatenated elements of values.

Exceptions

TypeReason
ArgumentNullException values is a null reference.

Remarks

The method concatenates each object in values; it does not add any delimiters.

An string.Empty string is used in place of any null object in the array.

Example

The following example demonstrates concatenating an array of strings.

C# Example

using System;
public class StringConcatExample {
 public static void Main() {
 string str = String.Concat( "one", "two", "three", "four", "five" );
 Console.WriteLine( "The concatenated String array is: {0}", str );
 }
}
   

The output is

The concatenated String array is: onetwothreefourfive

Requirements

Namespace: System
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0