J
Jeff
..NET 2.0
I'm having trouble with using a Exists method in generic lists. So here I
shows an example list and hope maybe some of you could give me some tips on
how to implement that Exists method
List<string> cars = new List<string>();
cars.Add("BMW");
cars.Add("Volvo");
cars.Add("Toyota");
cars.Add("Hyundai");
Now lets say I should test if an element in the list exists with the value
"Toyota".:
if (cars.Exists())
{
}
Here it stops for me, I'm not sure what to send in as parameters to the
Exists method. I've read the doc about the Exists method, it says it need a
Predicate as a parameter.. how do i create an predicate for this simple
list?
any suggestions are most welcome
Jeff
I'm having trouble with using a Exists method in generic lists. So here I
shows an example list and hope maybe some of you could give me some tips on
how to implement that Exists method
List<string> cars = new List<string>();
cars.Add("BMW");
cars.Add("Volvo");
cars.Add("Toyota");
cars.Add("Hyundai");
Now lets say I should test if an element in the list exists with the value
"Toyota".:
if (cars.Exists())
{
}
Here it stops for me, I'm not sure what to send in as parameters to the
Exists method. I've read the doc about the Exists method, it says it need a
Predicate as a parameter.. how do i create an predicate for this simple
list?
any suggestions are most welcome
Jeff