Luke Hoban

Luke Hoban Luke Hoban

Niner since 2007


  • Luke Hoban: Orcas - Compiling LINQ, C# Futures, Intellisense

    I'd say lambda expressions have two major benefits over anonymous methods.  First, they are syntactically more concise.  Since the functions defined by lambdas or anonymous methods are most often needed in-line as part of a larger expression - it's important to have a good concise syntax.  Otherwise, the code quickly becomes very difficult to read.  So a major goal for lambdas was to provide a really concise and readable way to declare these small functions in-line. 

    The other benefit is the type inference you mention.  This also helps with conciseness - but more importantly it avoids littering the type names all over a single simple expression, which can become a significant syntactic issue for many uses of lambdas.

    At a higher level - the emphasis on lambdas is actually much more general than LINQ.  We see many new APIs looking to provide the kind of level of abstraction that really requires taking delegates as arguments - and LINQ is just one example.  I definitely expect to see more of these APIs in other interesting domains over the coming months/years.