C# String Concat(Object[]) Array
Description
String Concat(Object[])
concatenates the string representations
of the elements in a specified Object array.
Syntax
String.Concat(Object[])
has the following syntax.
public static string Concat(
params Object[] args
)
Parameters
String.Concat(Object[])
has the following parameters.
args
- An object array that contains the elements to concatenate.
Returns
String.Concat(Object[])
method returns The concatenated string representations of the values of the elements in
args.
Example
The following example demonstrates the use of the Concat method with an Object array.
/* w ww .j a v a 2s . c o m*/
using System;
public class ConcatTest {
public static void Main() {
Test1 t1 = new Test1();
Test2 t2 = new Test2();
int i = 16;
string s = "java2s.com";
object [] o = { t1, i, t2, s };
Console.WriteLine(string.Concat(o));
}
}
class Test1 {
}
class Test2 {
}
The code above generates the following result.