More On Razor Syntax / Expressions

Share on Twitter

This post gets enough said about how the Razor parser works.

http://blog.andrewnurse.net/CommentView,guid,89b7bd90-52d7-4d49-b87d-4e888f285b4c.aspx

The guy, Andrew Nurse, is the one who wrote the parser!   (from Haack’s note)

 

After reading it and a quick chat with @Haacked on twitter, it seems all your “escape” kind of Razor expressions (that is meaning: when mixing code and text without spaces etc…) will look like @(someCode)someText. This is coming from an example, to escape a C# identifier that’s also a keyword, say “class”, you’d be using @(@class). The @(…) style is the new <%: … %> but only required for escape situations.

 

Also, it seems that switching from being equivalent to <%: … %> to being equivalent to <%= … %> by using some Razor notation is not gonna make it. You need to do it through doing some classes implementing IHtmlString interface.

 

Of course I’m not so sure that’s exactly the case. Anyway, Razor is only available now in WebMatrix mini-IDE, not much MVC love yet (pretty soon).  Just thought it might be interesting…

Share on Twitter

Related posts:

  1. Thoughts On Razor, Microsoft’s New ASP.NET MVC View Engine
    This is something I have posted to a private mailing...
  2. #DDDSydney 2011 Razor Session: Slides & Demo Code
    Thanks a lot everybody who attended my Razor session in...
  3. Just In Case You Missed The New ASP.NET Betas (WebMatrix, Razor, IIS Express, SQL Server Compact, Web Platform Installer)
    Similar to the last post, it looks like the best...
, , ,
Trackback

no comment untill now

Sorry, comments closed.