Hi I have case where I am getting the data from from my database and it looks like this:
I am using Entity Framework database first and a stored procedure to get this data.This is the model that I get back:
public partial class GetELearningSessionsForStudent_Result
{
public int LessonNumber { get; set; }
public string LessonTitle { get; set; }
public Nullable<int> Status { get; set; }
public Nullable<System.DateTime> TargetDate { get; set; }
public string EventTitle { get; set; }
}
Now I would like to be able to group LessonNumber and use it as a key , that would contain the following:
KEY Data
{LessonNumber AND LessonTitle} {Status , TargetDate , EventTitle}
I have been trying to do this for hours and it feels that I am somehoe missing something. How can I achieve this?
Is this what you're looking for?
listOfItems.GroupBy(key => new { key.LessonNumber, key.LessonTitle },
data => new {data.Status, data.TargetDate, data.EventTitle});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.