I recently switched jobs and am now happily spending my day actually doing development again rather than just telling other developers what to do (seems like a cyclical trend in my career).

In my new role, I’ll soon be doing some greenfield web development, so I’ve been brushing up on my UI skills as well as exploring some new frameworks and libraries as we try to settle on the stack we’ll be using.

One of the more refreshing discoveries has been the Razor view engine for the ASP.NET MVC framework.

There are a ton of cool features that I could enumerate, but to be honest I was pretty much won over as soon as I compared the syntax for doing simple for-loops and if-else branches.

Here’s an example using the traditional Web Forms engine (.aspx) page:

WebForms_Example

Here’s what the same code looks like using the Razor view engine (.cshtml):

Razor_Example

The noise reduction makes my heart go pitter-patter.

If you’re interested in finding out more, Scott Guthrie has some superb introductory posts covering both Razor and the new MVC 3 features in general.

Popularity: 2% [?]