Linq Select To List

[Solved] Linq Select To List | Scala - Code Explorer | yomemimo.com
Question : linq select to list

Answered by : francisco

class ProjectInfo
{ public string Name {get; set; } public long Id {get; set; }
}
public List<ProjectInfo> GetProjectForCombo()
{ using (MyDataContext db = new MyDataContext (DBHelper.GetConnectionString())) { var query = from pro in db.Projects select new ProjectInfo(){ Name = pro.ProjectName, Id = pro.ProjectId }; return query.ToList(); }
}

Source : https://stackoverflow.com/questions/6370028/return-list-using-select-new-in-linq | Last Update : Sat, 11 Jun 22

Answers related to linq select to list

Code Explorer Popular Question For Scala