System.String.Concat Method

Concatenates the members of a constructed IEnumerable`1 collection of type string.

Syntax

[System.Runtime.InteropServices.ComVisible(false)]
public static string Concat (IEnumerable<string> values)

Parameters

values
A collection object that implements IEnumerable`1 and whose generic type argument is string.

Returns

The concatenated strings in values.

Remarks

The method concatenates each object in values; it does not add any delimiters. To specify a delimiter between each member of values, call the string.Join(string, IEnumerable<string>) method.

An string.Empty string is used in place of any null argument.

string.Concat(IEnumerable<string>) is a convenience method that lets you concatenate each element in an IEnumerable(Of String) collection without first converting the elements to a string array. It is particularly useful with Language-Integrated Query (LINQ) query expressions. The following example passes a List(Of String) object that contains either the uppercase or lowercase letters of the alphabet to a lambda expression that selects letters that are equal to or greater than a particular letter (which, in the example, is "M"). The IEnumerable(Of String) collection that is returned by the System.Linq.Enumerable.Where``1(IEnumerable<``0>, Func<``0, bool>) method is passed to the string.Concat(IEnumerable<string>) method to display the result as a single string.

code reference: System.String.Concat#3

Requirements

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