Hi Andrew,
your problem is that the Exists method expects a Predicate<T> which is
another way of saying you need to put a delegate that returns a bool and
accepts a type of T i.e. delegate bool Predicate<T>(T obj)
So if you want to search your list to see if it contains a value of "Andrew"
you will need to create a method that matches the delegate signature (i.e.
one that returns a bool and accepts the type you define your list as being
(in your case string)
i.e.
private bool ContainsAndrew(string val)
{
return val == "Andrew";
}
//now to your list you would say:
List<string> BodyWords = new List<string>();
BodyWords.Add("Peter");
BodyWords.Add("Paul");
bool containsAndrew = BodyWords.Exists(ContainsAndrew);
The list will then iterate through all the items in the list, calling the
ContainsAndrew method against each item until a match is found (if there is a
match).
Hope that helps
Mark Dawson
http://www.markdawson.org