C# String Concat(Object, Object)
Description
String Concat(Object, Object)
concatenates the string
representations of two specified objects.
Syntax
String.Concat(Object, Object)
has the following syntax.
public static string Concat(
Object arg0,
Object arg1
)
Parameters
String.Concat(Object, Object)
has the following parameters.
arg0
- The first object to concatenate.arg1
- The second object to concatenate.
Returns
String.Concat(Object, Object)
method returns The concatenated string representations of the values of arg0 and arg1.
Example
The following example demonstrates the Concat method.
// w ww.j a va 2 s . c o m
using System;
class stringConcat5 {
public static void Main() {
int i = -123;
Object o = i;
Object[] objs = new Object[] {-123, -456, -789};
Console.WriteLine(String.Concat(o));
Console.WriteLine(String.Concat(o, o));
Console.WriteLine(String.Concat(o, o, o));
Console.WriteLine(String.Concat(o, o, o, o));
Console.WriteLine(String.Concat(o, o, o, o, o));
Console.WriteLine(String.Concat(objs));
}
}
The code above generates the following result.