This is a compiler error (slightly changed for readability).
This one always puzzled me. FxCop tells that this is a bad thing to return List and classes that are\\de
This is how you convert from List to Collection (while using LINQ):
The old function:
public List GetEmployee(int id)
{
return ( from e in MyDataContext.Employees
select new Employee()
{
e.empId = id
}
).ToList();
}
After conversion:
using System.Collection.ObjectModel;
public Collection GetEmployee(int id)
{
return new Collection(
(from e in MyDataContext.Employees
select new Employee()
{
e.empId = id
}
).ToList() as IList
);
}