Proposed C# extensions

by Miguel de Icaza

Scott Peterson has written a proposal to extend C# to support parameterless anonymous methods.

Scott's proposal includes a patch for Mono's C# compiler that implements the suggestion.

The short story is that with this patch allows constructor initializers to also initialize events in an object. So you can now write code like this:

var button = new Button () {
    Label = "Push Me",
    Relief = ReliefStyle.None,
    Clicked +=> Console.WriteLine ("ouch!")
};
	

Both Bockover and myself love the 3.0 initializer syntax for objects and the only place where the awesomeness broke was the event initialization.

Posted on 27 Jul 2009