Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

String.Concat Method (String[])

Concatenates the elements of a specified String array.

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

public static string Concat(
	params string[] values
)

Parameters

values
Type: System.String[]
An array of string instances.

Return Value

Type: System.String
The concatenated elements of values.

ExceptionCondition
ArgumentNullException

values is null.

OutOfMemoryException

Out of memory.

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

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

The following code example demonstrates the use of the Concat method with a String array.


using System;

public class Example
{
   public static void Demo(System.Windows.Controls.TextBlock outputBlock)
   {

      // make an array of strings. Note that we have included spaces
      string[] s = { "hello ", "and ", "welcome ", "to ", "this ", "demo! " };

      // put all the strings together
      outputBlock.Text += string.Concat(s) + "\n";

      // sort the strings, and put them together
      Array.Sort(s);
      outputBlock.Text += string.Concat(s) + "\n";
   }
}


Silverlight

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.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

Show:
© 2014 Microsoft