The syntax for an anonymous delegate

by alski 7. April 2008 23:15

I seem to have problems remembering the syntax remembering the syntax for anonymous delegates, so here it is.

return GetUnfilteredList().FindAll(new Predicate<MyObject>( delegate (MyObject instance)
{
    return (instance.IsWanted));
}));

What strikes me as a write this though is how confusing it is that the delegate doesn't have a return type. Maybe that's why I can never remember the syntax.

 

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags:

Code | DotNet2.0

Powered by BlogEngine.NET 1.4.5.0
Theme by Mads Kristensen

RecentComments

Comment RSS