C# How to place a comma after each word but the last in the list
- by user576712
I totally new to C# and learning as I go. I am stuck on issue which I'm hoping an experienced programmer can help. I have added a CheckedListBox to my form and added a collection of 6 items to it. I need all but the last item selected to have a comma placed beside it, so my question is: how can I tell C# NOT to place a comma beside the last item selected?
foreach (object itemChecked in RolesCheckedListBox.CheckedItems)
{
sw.Write(itemChecked.ToString() + ",");
}
Thanks for any help received!
Dan