Accepted answer

An alternative to Enumerable.Any that doesn't use Linq is List.Exists:

if (_myStructList.Exists(x => x.Name == "DAMN!")) ...


Try the Any() method in LiNQ:

using System.Linq;

if(_myStructList.Any(x => x.Name == "DAMN!")) ...

Contains() is a declared method of List<> and it expects an object as a parameter and uses equals to compare the objects.

Related Articles