Expression tree usage in ASP.NET MVC Preview 2 rocks!

The latest MVC release adds some pretty cool usage of LINQ expression trees. It's another example of how cool (and WAY beyond querying) LINQ is.

Specifically, you can now replace untyped, "magic" strings when rendering links like:

<%= Html.ActionLink("Sign up", "SignUp", "UserController", true) %>

to type-safe and therefore compile-time checked code:

<%= Html.ActionLink((UserController c) => c.SignUp(true), "Sign up") %>

or the equivalent syntax:

<%= Html.ActionLink<UserController...

Read full article

No Comments