Inside a using statement or other code block, Razor expects code, not markup.
Therefore, you must enter the code directly, not in @{ ... } .
The Razor parser interprets your code as @ (prints an empty expression), followed by a normal block of C # statements ( { ... } ).
You only use @{ ... } blocks to place code where Razor expects markup.
SLaks source share