Cannot implicitly convert type 'System.Collections.Generic.List<<anonymous type>>' to 'System.Collections.Generic.List<string>'

Viewed 7558

my code supposed to check two conditions and return the values but when i try to return q this error shows up

Cannot implicitly convert type 'System.Collections.Generic.List<< anonymous type: string Name, string File>>' to 'System.Collections.Generic.List< string>

and i tried everything but nothing worked also don't know to set List<string> or set it as List<EF_Model.PDF> ,PDF is a DTO in my model

this is my code

  internal List<string> Customers_File(int _id)
    {
        using (var Context = new EF_Model.CoolerEntities())
        {
            var q = from c in Context.Customers
                    where c.Id == _id &&
                    c.Ref_PDF != null
                    select new { c.PDF.Name, c.PDF.File };
            return q.ToList();
        }
    }
4 Answers
Related