Why we need named parameters

C# 4.0 brings the idea of named parameters to C#.  While optional/default arguments are of questionable value (this is from my VB.NET days), named parameters can really clear up the meaning of a method call.  We’re already faking named parameters, as seen here in the ASP.NET MVC codebase:

return GenerateUrl(
    null /* routeName */, 
    null /* controllerName */, 
    new RouteValueDictionary(valuesDictionary));

Obviously the above example isn’t compile-time safe and comments lie to you, so it will be nice to be able to provide named parameters, especially when the number of arguments grows in a method call.  Something to look forward to.

Domain Models in presentation frameworks