Which directive in _ViewImports.cshtml allows you to set the base class for the Razor views?
- @inherits
- @model
- @using
- @layout
The correct directive to set the base class for Razor views in _ViewImports.cshtml is @inherits. This directive specifies the full name of the class that the view should inherit from. It allows you to establish a custom base class for all views in a folder or the entire application, enabling you to add shared functionality to your views.
Loading...
Related Quiz
- You are new to ASP.NET Core development and are setting up your computer for the first time. What would be the primary software you'd need to install to get started?
- When you want to send a JSON response from your controller, which action result type should you utilize?
- If you needed to add a user to a specific role immediately after creating them programmatically, which method of the UserManager class would you use?
- If you wanted to change the way request logging is done in an ASP.NET Core application, which file would you typically modify?
- How can you use a layout page in Razor to define a consistent page structure across views?