Im trying to add a dynamic where clause to my linq code. But I am getting the following error. Other samples gives the same code but they are working fine so im not sure if i missed something.
var toBeReturn = db.estimate.ToList();
if(sname != null)
{
toBeReturn = toBeReturn.Where(x => x.estimate_status == sname);
}
Error:
Severity Code Description Project File Line Suppression State Error CS0266 Cannot implicitly convert type 'System.Collections.Generic.IEnumerable' to 'System.Collections.Generic.List'. An explicit conversion exists (are you missing a cast?)
Help please