I have the following function in which should return an IEnumerable type?how do I convert list to IEnumerable? and return an empty IEnumerable?
public IEnumerable<SoftwareImageTestPlan> GetAssignedTestPlansForSPSI(int SoftwareProductID, int SoftwareImageID)
{
var records = _entities.tblSoftwareImageTestPlans
.Where(x => x.SoftwareProductID == SoftwareProductID && x.SoftwareImageID == SoftwareImageID)
.ToList();
if (records == null)
return new List<SoftwareImageTestPlan>();
else
return records;
}
Error:
Cannot implicty convert type 'System.Collections.Generic.List<....> to System.Collections.Generic.IEnumerable<.....>.An explicit conversion exists(are you missing a cast?)