I can do the following with Find:
Racer theRacer2 = racers.Find(del egate(Racer racer) { return racer.Car ==
"Ferrari"; });
But I can't seem to do the same with BinarySearch, this:
int iktr = racers.BinarySe arch(delegate(R acer racer) { return racer.Car ==
"Ferrari"; });
gives me these errors:
The best overloaded method match for
'System.Collect ions.Generic.Li st<Generics.Rac er>.BinarySearc h(Generics.Race r)'
has some invalid arguments
and
Argument '1': cannot convert from 'anonymous method' to 'Generics.Racer '
Can I make this work with an anonymous method or do I need to create another
function to use BinarySearch?
Thanks,
Tom
Racer theRacer2 = racers.Find(del egate(Racer racer) { return racer.Car ==
"Ferrari"; });
But I can't seem to do the same with BinarySearch, this:
int iktr = racers.BinarySe arch(delegate(R acer racer) { return racer.Car ==
"Ferrari"; });
gives me these errors:
The best overloaded method match for
'System.Collect ions.Generic.Li st<Generics.Rac er>.BinarySearc h(Generics.Race r)'
has some invalid arguments
and
Argument '1': cannot convert from 'anonymous method' to 'Generics.Racer '
Can I make this work with an anonymous method or do I need to create another
function to use BinarySearch?
Thanks,
Tom
Comment