'Method Definition (inside of an Abstract Controller class) with no statements inside method code block returns call to itself how?
Inside ASP.NET CORE MVC source code from github.
I could not understand that , no statements are present inside method body,even then method returns a call to itself how ??? How Syntactically ?
How semantically ?
& How logically ???
public virtual ViewResult View()
{
return View(viewName: null);
}
This method is declared inside an Abstract class named Controller.
Link to the Source code https://github.com/dotnet/aspnetcore/blob/main/src/Mvc/Mvc.ViewFeatures/src/Controller.cs
Solution 1:[1]
It calls an overload that has a viewName argument.
public virtual ViewResult View(string? viewName)
{
return View(viewName, model: ViewData.Model);
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | David Browne - Microsoft |
