This line …
private readonly List<Department> departments = new List<Department>();
… should not be in the function, but outside, at the class scope, or make it a var
.
4
solved Why does this code compile in one solution but not in another? [closed]