2
Answers

can i declare variable in controller scope in MVC 5

Niraj Singh

Niraj Singh

5y
3.7k
1
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.
Answers (2)