I want to have code that runs as efficiently as possible. I have views that are located in locations such as:
~/Areas/Administration/Views/Accounts/Create.cshtml
What I would like to know is has anyone looked into if it is more efficient to directly code the view location in action like this:
return View("~/Areas/Administration/Views/Accounts/Create.cshtml", vm);
If not coded like this then I believe it would search all the following locations first:
~/Areas/Administration/Views/Accounts/Create.aspx
~/Areas/Administration/Views/Accounts/Create.ascx
~/Areas/Administration/Views/Shared/Create.aspx
~/Areas/Administration/Views/Shared/Create.ascx
~/Views/Accounts/Create.aspx
~/Views/Accounts/Create.ascx
~/Views/Shared/Create.aspx
~/Views/Shared/Create.ascx
~/Areas/Administration/Views/Accounts/Create.cshtml
Don't worry about this and never hardcode your view locations like this. When running in Release
mode ASP.NET MVC keeps those locations cached and it doesn't perform all those expensive lookups.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With