Began to master ASP.NET Core. When trying to implement a simple application, the error crashes:
NullReferenceException: Object reference not set.
Controller:
[Route("")] public class ValuesController : Controller { // GET api/values [HttpGet] public IActionResult Get() { string[] files = {"wqew", "12232" }; return View("~/Index.cshtml", files); } } Index.cshtml file:
@page @model string[] @{ } <ul> @foreach (string file in Model) { <li>@file</li> } </ul> As soon as the server starts, the above error appears on this line:
@foreach (string file in Model)