Pergunta

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.

Foi útil?

Solução

int intArrayNum = lblNames.Length - lbNames.replace(",").Length
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top