Hello All,
Can i declare a variable in controller scope in Asp.net Mvc5 application or not?
For Example:
public class EmloyeeController : Controller
{
private readonly IEmployee _employee;
public EmployeeController(IEmployee emp){
{
_employee=emp;
}
}
this line gives error that "Method must have return type" where I have declare a private variable of type IEmployee.

Gopaiah NekarukantiRank #2,077 · 695 reputationPosted Nov 24, 2019, 7:36 PM EST
Laxmidhar SahooRank #383 · 6.6K reputationPosted Nov 23, 2019, 8:38 PM EST