Enumerable.Concat not working on empty list

Viewed 3956

I have below code which retrieves a list from a subfunction and returns it back to a main function. My problem is I cannot concatenate the result from the subfunc to the enumerable declared in mainfunc. Is there something I am missing?

private void MainFunc()
{
    IEnumerable<CustomClass> keys = Enumerable.Empty<CustomClass>();
    foreach (var item in items)
    {
        keys.Concat(SubFunc(item));
    }
}
private IEnumerable<CustomClass> SubFunc (string y)
{
    IEnumerable<CustomClass> list = GetList(y).ToList();
    return list;
}
1 Answers
Related