Skip to main content
.NET Framework Class Library
StringConcat Method (String, String, String)

Concatenates three specified instances of String.

Namespace:   System
Assembly:  mscorlib (in mscorlib.dll)
Syntax
Public Shared Function Concat ( _
	str0 As [%$TOPIC/5e285t1h_en-us_VS_110_2_0_0_0_0%], _
	str1 As [%$TOPIC/5e285t1h_en-us_VS_110_2_0_0_0_1%], _
	str2 As [%$TOPIC/5e285t1h_en-us_VS_110_2_0_0_0_2%] _
) As [%$TOPIC/5e285t1h_en-us_VS_110_2_0_0_0_3%]
public static [%$TOPIC/5e285t1h_en-us_VS_110_2_0_1_0_0%] Concat(
	[%$TOPIC/5e285t1h_en-us_VS_110_2_0_1_0_1%] str0,
	[%$TOPIC/5e285t1h_en-us_VS_110_2_0_1_0_2%] str1,
	[%$TOPIC/5e285t1h_en-us_VS_110_2_0_1_0_3%] str2
)
public:
static [%$TOPIC/5e285t1h_en-us_VS_110_2_0_2_0_0%]^ Concat(
	[%$TOPIC/5e285t1h_en-us_VS_110_2_0_2_0_1%]^ str0, 
	[%$TOPIC/5e285t1h_en-us_VS_110_2_0_2_0_2%]^ str1, 
	[%$TOPIC/5e285t1h_en-us_VS_110_2_0_2_0_3%]^ str2
)
static member Concat : 
        str0:[%$TOPIC/5e285t1h_en-us_VS_110_2_0_3_0_0%] * 
        str1:[%$TOPIC/5e285t1h_en-us_VS_110_2_0_3_0_1%] * 
        str2:[%$TOPIC/5e285t1h_en-us_VS_110_2_0_3_0_2%] -> [%$TOPIC/5e285t1h_en-us_VS_110_2_0_3_0_3%]

Parameters

str0
Type: SystemString

The first string to concatenate.

str1
Type: SystemString

The second string to concatenate.

str2
Type: SystemString

The third string to concatenate.

Return Value

Type: SystemString
The concatenation of str0, str1, and str2.
Remarks

The method concatenates str0, str1, and str2; it does not add any delimiters.

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

Examples

In the following example, the output to the console is generated using this Concat method.

Option Explicit
Option Strict

Imports System
Imports System.Globalization

Public Class MainClass

    Public Shared Sub Main()
        Dim dt As DateTime = DateTime.Now
        Dim myformat() As String =  {"d", "D", _
                                    "f", "F", _
                                    "g", "G", _
                                    "m", _
                                    "r", _
                                    "s", _
                                    "t", "T", _
                                    "u", "U", _
                                    "y", _
                                    "dddd, MMMM dd yyyy", _
                                    "ddd, MMM d ""'""yy", _
                                    "dddd, MMMM dd", _
                                    "M/yy", _
                                    "dd-MM-yy"}
        Dim mydate As String 
        Dim i As Integer 
        For i = 0 To myformat.Length - 1
            mydate = dt.ToString(myformat(i), DateTimeFormatInfo.InvariantInfo)
            Console.WriteLine(String.Concat(myformat(i), " :", mydate))
        Next i

    ' Output. 
    ' 
    ' d :08/17/2000 
    ' D :Thursday, August 17, 2000 
    ' f :Thursday, August 17, 2000 16:32 
    ' F :Thursday, August 17, 2000 16:32:32 
    ' g :08/17/2000 16:32 
    ' G :08/17/2000 16:32:32 
    ' m :August 17 
    ' r :Thu, 17 Aug 2000 23:32:32 GMT 
    ' s :2000-08-17T16:32:32 
    ' t :16:32 
    ' T :16:32:32 
    ' u :2000-08-17 23:32:32Z 
    ' U :Thursday, August 17, 2000 23:32:32 
    ' y :August, 2000 
    ' dddd, MMMM dd yyyy :Thursday, August 17 2000 
    ' ddd, MMM d "'"yy :Thu, Aug 17 '00 
    ' dddd, MMMM dd :Thursday, August 17 
    ' M/yy :8/00 
    ' dd-MM-yy :17-08-00 
    End Sub 'Main 
End Class 'MainClass
using System;
 using System.Globalization; 

public class MainClass { 
    public static void Main(string[] args)  {
        DateTime dt = DateTime.Now;
        String[] format = {
            "d", "D",
            "f", "F",
            "g", "G",
            "m",
            "r",
            "s",
            "t", "T",
            "u", "U",
            "y",
            "dddd, MMMM dd yyyy",
            "ddd, MMM d \"'\"yy",
            "dddd, MMMM dd",
            "M/yy",
            "dd-MM-yy",
        };
        String date;
        for (int i = 0; i < format.Length; i++) {
            date = dt.ToString(format[i], DateTimeFormatInfo.InvariantInfo);
            Console.WriteLine(String.Concat(format[i], " :" , date));
        }

   /** Output.
    *
    * d :08/17/2000
    * D :Thursday, August 17, 2000
    * f :Thursday, August 17, 2000 16:32
    * F :Thursday, August 17, 2000 16:32:32
    * g :08/17/2000 16:32
    * G :08/17/2000 16:32:32
    * m :August 17
    * r :Thu, 17 Aug 2000 23:32:32 GMT
    * s :2000-08-17T16:32:32
    * t :16:32
    * T :16:32:32
    * u :2000-08-17 23:32:32Z
    * U :Thursday, August 17, 2000 23:32:32
    * y :August, 2000
    * dddd, MMMM dd yyyy :Thursday, August 17 2000
    * ddd, MMM d "'"yy :Thu, Aug 17 '00
    * dddd, MMMM dd :Thursday, August 17
    * M/yy :8/00
    * dd-MM-yy :17-08-00
    */
    }
}
using namespace System;
using namespace System::Globalization;
void main()
{
   DateTime dt = DateTime::Now;
   array<String^>^format = {L"d",L"D",L"f",L"F",L"g",L"G",L"m",L"r",L"s",L"t",L"T",L"u",L"U",L"y",L"dddd, MMMM dd yyyy",L"ddd, MMM d \"'\"yy",L"dddd, MMMM dd",L"M/yy",L"dd-MM-yy"};
   String^ date;
   for ( int i = 0; i < format->Length; i++ )
   {
      date = dt.ToString( format[ i ], DateTimeFormatInfo::InvariantInfo );
      Console::WriteLine( String::Concat( format[ i ], L" :", date ) );

   }

   /** Output.
       *
       * d :08/17/2000
       * D :Thursday, August 17, 2000
       * f :Thursday, August 17, 2000 16:32
       * F :Thursday, August 17, 2000 16:32:32
       * g :08/17/2000 16:32
       * G :08/17/2000 16:32:32
       * m :August 17
       * r :Thu, 17 Aug 2000 23:32:32 GMT
       * s :2000-08-17T16:32:32
       * t :16:32
       * T :16:32:32
       * u :2000-08-17 23:32:32Z
       * U :Thursday, August 17, 2000 23:32:32
       * y :August, 2000
       * dddd, MMMM dd yyyy :Thursday, August 17 2000
       * ddd, MMM d "'"yy :Thu, Aug 17 '00
       * dddd, MMMM dd :Thursday, August 17
       * M/yy :8/00
       * dd-MM-yy :17-08-00
       */
}
Version Information

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0, 1.1, 1.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

.NET for Windows Phone apps

Supported in: Windows Phone 8.1, Windows Phone 8, Silverlight 8.1
Platforms

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.