ASP.NET MVC: Comparing same view on ASP.NET and Razor view engine

I ported views of my ASP.NET MVC application from ASP.NET to Razor. Although Razor is very new it is very promising view engine because of shorter and cleaner syntax. In this posting I will show you same view on ASP.NET and Razor view engine. I like Razor one more but what do you think?

My contacts table on ASP.NET view engine is here. You can open both images on separate windows and switch between them to see differences.

Contacts index with ASP.NET view engine

And here is the same view in Razor. Notice that ASP.NET MVC 3 RC has support for Razor syntax highlight. Click on image to view it at original size.

Contact index with Razor view engine

If you see these images at original size you see the effect.

For me Razor view is easier to read because there is less noise caused by template symbols. I think this view is not complex one. If there are more loops and conditionals in our view then I am sure ASP.NET version of it looks messier.

Gunnar Peipman

Gunnar Peipman is ASP.NET, Azure and SharePoint fan, Estonian Microsoft user group leader, blogger, conference speaker, teacher, and tech maniac. Since 2008 he is Microsoft MVP specialized on ASP.NET.

    Leave a Reply

    Your email address will not be published. Required fields are marked *