如何List<personel>
从以下过程返回数据类型。如果我按 F5,它会给我这个错误:
错误 1 无法将类型“System.Linq.IQueryable”隐式转换为“System.Collections.Generic.List”。存在显式转换(您是否缺少演员表?) C:\Documents and Settings\yusufk\Desktop\EFTestSolutions\WebApplicationTest1\WebApplicationTest1\Default.aspx.cs 101 61 WebApplicationTest1
我认为我应该重新排列或重新编码“select new {...”?
protected List<personel> GetPersonalsData2()
{
List<personel> personeller;
using (FirmaEntities firmactx = new FirmaEntities())
{
personeller = (from p in firmactx.Personals
select new { p.ID, p.Name, p.SurName });
return personeller.ToList();
}
}
public class personel
{
public int ID { get; set; }
public string Name { get; set; }
public string SurName { get; set; }
}