Using String.Join in c# 4.0

Madhu.b.rokkam
Posted by Madhu.b.rokkam under C# category on | Points: 40 | Views : 2427
static void Main(string[] args)
{

string[] values = { "Ram", "Shyam", "Gopal" };
Console.WriteLine(string.Join(",", values));

int[] nums = { 0, 9, 8, 7, 6, 5, 4, 3, 2, 1 };
Console.WriteLine(string.Join(",", nums));

Console.Read();
}


Result

Ram,Shyam,Gopal
0,9,8,7,6,5,4,3,2,1

Comments or Responses

Posted by: Jayeshl on: 6/1/2011 Level:Starter | Status: [Member] | Points: 10
hi friend i find error in second join


Argument '2': cannot convert from 'int[]' to 'string[]'

so verify me if i am doing anything wrong here.

string[] values = { "Ram", "Shyam", "Gopal" };


Response.Write(string.Join(",", values));



int[] nums = { 0, 9, 8, 7, 6, 5, 4, 3, 2, 1 };

Response.Write(string.Join(",", nums));


Login to post response