Using asp.net MVC I’d like to do this inside a view:
<%= Html.TextBox('textbox1', null, new { class='class1' }) %>
This statement does not compile because class is keyword in C#. I’d like to know how I can escape the property names such that this compiles.
It is possible to get this to compile if I change the ‘class’ property to ‘Class’ (uppercase C). But this is not suitable because strict xhtml says that all attributes (and element) names must be lowercase.
You can use keywords in C# as identifiers by prepending @ infront of them.
To quote from the MSDN Documentation on C# Keywords: