I watched the plural tutorial about asp.net MVC 5 framework And I saw something wonderful to speed up my encoding. I googled it and I did not find it. I may not have used the right keywords. anyway, this is what I saw:
1- he created a constructor for Controller, and the code was something like this:
public class HomeController : Controller
{
public HomeController(ApplicationDbContext context)
{
}
and the cursor was on the word "context", he used a shortcut and noise when the code did not become like this:
public class HomeController : Controller
{
private readonly ApplicationDbContext _context;
public HomeController(ApplicationDbContext context )
{
_context = context;
}
What shortcut did he use to create such properties? Does anyone know how I can do this?
source
share