문제

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.

도움이 되었습니까?

해결책

int intArrayNum = lblNames.Length - lbNames.replace(",").Length
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top