Hey,
How would I go about finding the amount of values, say "DaniWeb" in a List<string>? I just need a number, not their index.
Cheers

Sorted, the answer (for anyone interested) was:

List.Count(c => c == "DaniWeb");

Hey,
How would I go about finding the amount of values, say "DaniWeb" in a List<string>? I just need a number, not their index.
Cheers

What do you mean "amount of values"? I don't understand the question.

Nevermind, BBman obviously understood. :)

Edited 6 Years Ago by Zinderin: n/a

Hey,
How would I go about finding the amount of values, say "DaniWeb" in a List<string>? I just need a number, not their index.
Cheers

Hi bbman,

The simplest way of achieving this would be a simple "for" or "foreach" loop.

int countFoo = 0;
foreach (string strSomething in listSomething)
{
    if(strSomething == "foo") countFoo++;
}

Vasiliy

Cheers for the replies, but it's already sorted out. The best method was what I posted.
Cheers.

This question has already been answered. Start a new discussion instead.