I was trying to use the following statement:
@Html.Test<ISQL>().Nand()
However, Razor is choking at the < before the ISQL.
Any official work around for it?
I was trying to use the following statement:
@Html.Test<ISQL>().Nand()
However, Razor is choking at the < before the ISQL.
Any official work around for it?
I had a strange case when I had several assignments inside of one
@{ ... }
bock.What ever I did, there were always errors, like this:
The solution: I put the assignment line to a second
@{ ... }
bock.I appreciate that this 'answer' is somewhat late and the question has obviously been satisfactorily (and well) answered. However, for any future visitors to this page, if you're after a more complete reference guide there's the MS introduction to Razor syntax as well as Phil Haack's very useful Razor quick reference blog post.
I just found this question when I was looking for this "same error" when upgrading mvc.
I had :
Does not work:
Apparently, the syntax went stricter, and as you are inside a @{} block, you should not add @ before Model.Title on the example. But the error on the code editor was pointing to the generic and it was getting me crazy.
It works fine if there is no <> inside the code, but just removing the @ from Model.Title fix the issue.
Works:
Hope this helps to anyone
To use generic methods you need to escape the expression
It's about the @ character, this example works before upgrade
After upgrade, it must be separated into two blocks