Quantcast
Viewing latest article 4
Browse Latest Browse All 4

how to convert list to IEnumerable?

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?)

Image may be NSFW.
Clik here to view.
error


Viewing latest article 4
Browse Latest Browse All 4

Trending Articles