I was sitting around munching some code, and needed to filter a list I had:
List
<Whatever> list = // get listoutputList = list.FindAll(delegate(Whatever item)
{
if (// blah blah)
{
return true;
}
else
{
return false;
}
}
);
(Ignore the greyed-out text for now).
When compiling, I got a strange error message:
"cannot convert from 'anonymous method' to 'System.Predicate
This put me off for a few minutes while I tried checking code samples and such to make sure that this really SHOULD work. Only when I tried explicitly casting the anonymous delegate to a Predicate
'System.Predicate
Turns out my actual syntax error was being caught by the compiler and incorrectly reported.
Just a heads-up, in case it happens to anyone else.
Ladybug bug ID is FDBK50271, if anyone cares.
