"Tony Johansson" <(E-Mail Removed)> wrote in message
news:ilto87$64k$(E-Mail Removed)...
> I have a collection of List<Player> and I want to find the index where the
> passed name match the player name in the collection.
> Is the only solution to this to loop through the collection and check each
> object.
>
> I assume there is a better way
Then you make the same incorrect assumption that a lot of people do, because
ultimately a loop will be involved. Now, if you mean there must be a better
way than explicitly writing loop code, you could take advantage of extension
methods like Find(), assuming you're using .NET 3.x or higher. But there
WILL be a loop....
|