string s = "a,b,,";
string[] t = s.Split(',');
MessageBox.Show((t.Length-1).ToString());结果为3
很简单:
string s = "asdegnri,e,wgbiergb,kjw,,eq,f";
int i = s.Count(c => c == ',');
Console.WriteLine(i);