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 (Object, Object, Object)

Concatenates the String representations of three specified objects.

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

public static string Concat (
	Object arg0,
	Object arg1,
	Object arg2
)
public static String Concat (
	Object arg0, 
	Object arg1, 
	Object arg2
)
public static function Concat (
	arg0 : Object, 
	arg1 : Object, 
	arg2 : Object
) : String

Parameters

arg0

The first Object.

arg1

The second Object.

arg2

The third Object.

Return Value

The concatenated String representations of the values of arg0, arg1, and arg2.

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

The following code example demonstrates the Concat method.

using System;

class stringConcat5 {
    public static void Main() {
    int i = -123;
    Object o = i;
    Object[] objs = new Object[] {-123, -456, -789};

    Console.WriteLine("Concatenate 1, 2, and 3 objects:");
    Console.WriteLine("1) {0}", String.Concat(o));
    Console.WriteLine("2) {0}", String.Concat(o, o));
    Console.WriteLine("3) {0}", String.Concat(o, o, o));

    Console.WriteLine("\nConcatenate 4 objects and a variable length parameter list:");
    Console.WriteLine("4) {0}", String.Concat(o, o, o, o, o));

    Console.WriteLine("\nConcatenate a 3 element object array:");
    Console.WriteLine("5) {0}", String.Concat(objs));
    }
}
/*
This example produces the following output:
Concatenate 1, 2, and 3 objects:
1) -123
2) -123-123
3) -123-123-123

Concatenate 4 objects and a variable length parameter list:
4) -123-123-123-123-123

Concatenate a 3 element object array:
5) -123-456-789
*/

import System.*;

class StringConcat5
{
    public static void main(String[] args)
    {
        int i = -123;
        Object o = (Int32)i;
        Object objs[] = new Object[] { (Int32)(-123), (Int32)(-456), 
            (Int32)(-789) };

        Console.WriteLine("Concatenate 1, 2, and 3 objects:");
        Console.WriteLine("1) {0}", String.Concat(o));
        Console.WriteLine("2) {0}", String.Concat(o, o));
        Console.WriteLine("3) {0}", String.Concat(o, o, o));

        Console.WriteLine("\nConcatenate 4 objects and a variable length "
            + "parameter list:");
        Object objArr[] = { o, o, o, o, o };
        Console.WriteLine("4) {0}", String.Concat(objArr));

        Console.WriteLine("\nConcatenate a 3 element object array:");
        Console.WriteLine("5) {0}", String.Concat(objs));
    } //main
} //StringConcat5
/*
This example produces the following output:
Concatenate 1, 2, and 3 objects:
1) -123
2) -123-123
3) -123-123-123

Concatenate 4 objects and a variable length parameter list:
4) -123-123-123-123-123

Concatenate a 3 element object array:
5) -123-456-789
*/

Windows 98, Windows 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions

Show:
© 2014 Microsoft