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, String, String)

Concatenates three specified instances of String.

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

public static string Concat (
	string str0,
	string str1,
	string str2
)
public static String Concat (
	String str0, 
	String str1, 
	String str2
)
public static function Concat (
	str0 : String, 
	str1 : String, 
	str2 : String
) : String
Not applicable.

Parameters

str0

The first String.

str1

The second String.

str2

The third String.

Return Value

The concatenation of str0, str1, and str2.

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

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

 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
    */
    }
}

import System.*;
import System.Globalization.*;

public class MainClass
{
    public static void main(String[] args)
    {
        DateTime dT = DateTime.get_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.get_Length(); i++) {
            date = dT.ToString(format[i], DateTimeFormatInfo.get_InvariantInfo());
            Console.WriteLine(String.Concat(format[i], " :", date));
        }
    } //main 
} //MainClass 

 /** 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
    */

import System;
import System.Globalization; 
 

var dt : DateTime = DateTime.Now;
var format : 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",
    ];
var date : String;
for (var i : int = 0; i < format.Length; i++) {
    date = dt.ToString(format[i], DateTimeFormatInfo.InvariantInfo);
    Console.WriteLine(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
    */

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

XNA Framework

Supported in: 1.0

Community Additions

Show:
© 2014 Microsoft. All rights reserved.