System.String.Concat Method

Concatenates the string representations of the elements in a specified object array.

Syntax

public static string Concat (params object[] args)

Parameters

args
An object array that contains the elements to concatenate.

Returns

The concatenated string representations of the values of the elements in args.

Exceptions

TypeReason
ArgumentNullException args is a null reference.

Remarks

The method concatenates each object in args by calling the parameterless ToString method of that object; it does not add any delimiters.

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

Example

The following example demonstrates concatenating an array of objects.

C# Example

using System;
public class StringConcatExample {
 public static void Main() {
 string str = String.Concat( 'c', 32, "String" );
 Console.WriteLine( "The concatenated Object array is: {0}", str );
 }
}
   

The output is

The concatenated Object array is: c32String

Requirements

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