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. :)

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.