I've traditionally always put @using
directives in my ASP.NET Razor pages at the top, along with the @model
directive. However, for my overall layout, I want to make sure the DOCTYPE
declaration is at the very beginning of the document, so I want to push the @using
down a bit. Would you following be valid?
<!DOCTYPE html>
<html>
@using My.Library;
<head>
<title>Test web page</title>
...
Also, is there any documentation on where the @using
directive can be used in Razor pages? I can't seem to find any. Is it valid to use it after some other Razor code, for example, or does it have to appear first?