In pre-Razor MVC I could write this in a view:
<span>I want to write in<%= myVariable %>side</span>
In Razor, of course I can’t
<span>I want to write in@myVariableside</span>
bacause the template engine would look for the variable @myVariableside. How to solve this? Thanks
First – have you tried it?
Secondly – if the interpreter has issues – you can try
@(myVariableside).Equally if the variable name you’re talking about is
@name– then once you’re inside the parentheses everything’s fine, because the interpreter knows it’s parsing C#/VB:@(@myVariableside)