Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

String.Concat Method (String())

Concatenates the elements of a specified String array.

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

'Declaration
Public Shared Function Concat ( _
	ParamArray values As String() _
) As String

Parameters

values
Type: System.String()
An array of string instances.

Return Value

Type: System.String
The concatenated elements of values.

ExceptionCondition
ArgumentNullException

values is Nothing.

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.



Public Class Example

   Public Shared Sub Demo(ByVal outputBlock As System.Windows.Controls.TextBlock)
      Dim s As String() = {"hello ", "and ", "welcome ", "to ", "this ", "demo! "}

      ' make an array of strings. Note that we have included spaces

      ' put all the strings together
      outputBlock.Text &= String.Concat(s) & vbCrLf

      ' sort the strings, and put them together
      Array.Sort(s)
      outputBlock.Text &= String.Concat(s) & vbCrLf
   End Sub 'Main
End Class 'ConcatTest


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.

Community Additions

ADD
Show:
© 2015 Microsoft