/ Published in: C#
This can be useful for string preparations.
Expand |
Embed | Plain Text
string str = ""; // loop though an array and create a string // delimited with commas foreach (string s in fieldNames) { str += s; // if this not the last item in the array // append a comma to end of the string. if (s != fieldNames[fieldNames.Length - 1]) { str += ", "; } }
Comments
Subscribe to comments
You need to login to post a comment.

Check out the String.Join method... does the same thing... probably faster and more efficient:
http://msdn.microsoft.com/en-us/library/system.string.join.aspx