About Me


Develop With Passion® - Developer Bootcamp


Closing an anonymous method to a known delegate type

Written July 28, 2009 at 14:00 MDT Tagged c sharp

If you are using extension methods as a way to achieve more language oriented programming, there are lots of times you will want to be able to run extension methods against an anonymous method, but you will first have to close it to a well known delegate type before it is allowed. Here is a useful method if you want the starting point to be an anonymous method created on the fly:

public class CreateDelegate


public static DelegateType of(DelegateType body) {

return body;



Develop With Passion!