Csc.exe and delegate inference, or: Why C# has awkward syntax
I just tried to to do a major revamp of Rhino Mocks' interface. It was intended to make it easier to work with C# 3.0 and use the smarter compiler to get better syntax.
I shouldn't have bothered. Take a look at this.
public class TestCsc { public static void TestMethod() { Execute(Bar); // fail to compile Execute(delegate(int ia, string x) { }); // compiles fine Execute((int i, string x) => { return; }); // Compiles fine Execute((int i, string x) => { return true; }); // fail to compile Execute(Foo);// fail to compile Execute(delegate(int ia, string x) { return true; }); // fail to compile } public static bool Foo(int ia, string x) { return false; } public static void Bar(int ia, string x) { } public static void Execute<T, K>(Action<T, K> e) { } public static void Execute<T, K>(Func<bool, T, K> e) { } }
Annoyed.

Comments
Comment preview