This is the Code for adding comma after another number, but I want to delete the last comma:
str_MSISDN.Append("'" + _MSISDN[x].TrimStart() + "'" + ",");
解决方案
Instead of manually appending things, I suggest you use String.Join which will get it right to start with. You can use LINQ to do the trimming of the values. For example:
string x = string.Join(",", _MSISDN.Select(x => "'" + x.TrimStart() + "'")
.ToArray());
EDIT: A nicer version of this is available with MoreLINQ and its ToDelimitedString method:
string x = _MSISDN.Select(x => "'" + x.TrimStart() + "'")
.ToDelimitedString(",");