javascript equivalent of join() and toString() in c#?
if you wish to add the functionality to a string array you could do with an extension method
public static class ArrayExtension
{
public static string AsString(this string[] array, string seperator)
{
return string.Join(seperator, array);
}
}
Then you would write:
var keyStr = keyList.AsString("_");
You can use string.Join()
:
string.Join("_", array);
or, for lists:
string.Join("_", list);
Converting a string array into a single string is done exactly the same way: With string.Join()
:
string.Join(" ", stringarray);
Dan Elliott also has a nice extension method you can use to be a little closer to JavaScript, syntax-wise.