Examples

Variable Model correspond to the active instance from @model

Pages\Index.cshtml

@page
@model IndexModel
@{
  ViewData["Title"] = "string";
}

@If (Condition)
{
   html
}
@Variable

<div>some html here</div>
<p>@ViewData["Title"]</p>

Pages\Index.cshtml.cs

namespace myWebApp.Pages
{
  public class IndexModel : PageModel
  {
     # constructor with Microsoft.Extensions.Logging.ILogger)
     # function void OnGet()
  }
}