HOME > .NET Framework > Forum > รบกวนดู code linq Cannot initialize type 'Unit' with a collection initializer because it does not implement 'System.Collections.IEnumerable'
รบกวนดู code linq Cannot initialize type 'Unit' with a collection initializer because it does not implement 'System.Collections.IEnumerable'
รบกวนท่านเทพดู ให้หน่อยครับ error Error 1 Cannot initialize type 'Unit' with a collection initializer because it does not implement 'System.Collections.IEnumerable' D:\project\store\store\Persistence\UnitPer.cs 46 79 store
public List<Unit> ShowUnit(DataContext db)
{
UnitTable = db.GetTable<Unit>();
List<Unit> res = new List<Unit>();
res = (from c1 in UnitTable where(c1.Status==1)select new Unit{
c1.UnitID,
c1.Status
}).ToList();
return res;