Question

string lbNames = String.Join(", ", (from ListItem li in lbName.Items where li.Selected select li.Value.ToString()).ToArray());

I have this code above that gathers selected item in an ListBox and separated them by names with a comma into one string value. e.g. Bob, Peter, Dick, James

How do I get the number of array I was able to get from the selected value? In this case 4.

Était-ce utile?

La solution

int intArrayNum = lblNames.Length - lbNames.replace(",").Length
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top