Recursion in ASP.NET Core Razor views
问题 I have the following code right now to write a flat list of items with a link to a controller action: <ul> @foreach (var item in items) { <li> <a asp-controller="Home" asp-action="Demo" asp-route-itemName="@item.Name"> @item.Name </a> </li> } </ul> Now this must become recursive. Items can also contain subitems. For recursion I need some sort of function. I know I could use @functions and define the function in the .cshtml file. Not sure whether such nice inline HTML code with tag helpers