String.Concat Method (Object[])

Updated: October 2010

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

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

public static string Concat(
	params Object[] args


Type: System.Object[]
An object array that contains the elements to concatenate.

Return Value

Type: System.String
The concatenated string representations of the values of the elements in args.


args is null.


Out of memory.

The method concatenates each object in argsby 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.

The following code example demonstrates the use of the Concat method with an Object array.

using System;

public class Example
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
      // Create a group of objects.
      Test1 t1 = new Test1();
      Test2 t2 = new Test2();
      int i = 16;
      string s = "Demonstration";

      // Place the objects in an array.
      object[] o = { t1, i, t2, s };

      // Concatenate the objects together as a string. To do this,
      // the ToString method of each of the objects is called.
      outputBlock.Text += string.Concat(o) + "\n";

// Create two empty test classes.
class Test1

class Test2
// The example displays the following output:
//      Test116Test2Demonstration


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.




October 2010

Revised the Remarks section.

Customer feedback.

Community Additions