I was needed to convert an string array into the comma delimited string and the old way to do that is too with for loop. But I was sure that there should be some ready made function that will do this very easily.
After doing some research I have found string.Join. With the help of this we can easily an array into the comma delimited string.
String.join have two arguments one is separator and other one is either array or enumerable.
Following is a code for that.
Let’s run that example and here is the output as expected.
That’s it. Hope you like it. Stay tuned for more..
After doing some research I have found string.Join. With the help of this we can easily an array into the comma delimited string.
String.join have two arguments one is separator and other one is either array or enumerable.
Following is a code for that.
namespace ConsoleApplication3 { class Program { static void Main() { string[] name = {"Jalpesh", "Vishal", "Tushar", "Gaurang"}; string commnaDelmietedName = string.Join(",", name); System.Console.WriteLine(commnaDelmietedName); } } }
Let’s run that example and here is the output as expected.
That’s it. Hope you like it. Stay tuned for more..
nice article :)
ReplyDeleteCan u explain article Jelph how to handle login on g icon click here on coment area ?
ReplyDeletethanks I think you have already got that to login with google plus
ReplyDelete