I need to alias a type with a using
directive, which is normally done like so:
using LocalResources = Resources.Admin.SomeResource;
How can I do this inside my Razor view so that I can then use it like @LocalResources.FirstName
?
I need to alias a type with a using
directive, which is normally done like so:
using LocalResources = Resources.Admin.SomeResource;
How can I do this inside my Razor view so that I can then use it like @LocalResources.FirstName
?
Here is how
@using File = System.IO.File //at the top of the page then
// use @File any where in the cshtml page.
Razor does not currently support type or namespace aliasing. This is something that we might consider for future versions.