Earlier quoted context omitted.
It's sad how C# is put on a pedestal, since it has plenty of obvious critical flaws, see links below for a list and this is just the tip of the iceberg. http://hestia.typepad.com/flatlander/2012/01/action-func-voi... http://trelford.com/blog/post/LighterCSharp.aspx http://stackoverflow.com/questions/411906/c-sharp-net-design... http://joeduffyblog.com/2010/06/27/on-partiallyconstructed-o... http://blogs.msdn.com/b/ds…
http://hestia.typepad.com/flatlander/2012/01/action-func-voi... I fail to see how it is an "obvious critical flaw" :) You have to create a separate overload that takes an Action instead of a Func, and has an identical implementation except for omitting the return keyword. Granted, that’s not much work for a simple helper like the above, but what if it were more complicated? No, it's simply not true that you need "an…
The problem is that void can't be used as a regular type identifier.
In a lot of langages (like Python, Haskell, F#, ...) there is a regular type for void. This type is often implemented as such :
sealed struct Void {
}
Then you can define Action just as Func.As the compiler is smart enough to see there is only one kind of Void value, it can be entierly removed from the generated code and thus doesn't make your code slower.