I am new to LINQ. I have a class like this:
public class StudentResults
{
public int Id { get; set; }
public ResultsStatus StatusResult { get; set; }
public string Message { get; set; }
public StudentDetails Detail { get; set; }
}
There is a method that returns a List of the above class to a variable
I need to iterate thru that variable and put the students into two different classes. PassedStudents, FailedStudents based on ResultsStatus.
Here is what I have tried but it doesnt work
var studIds = from r in StudList
group r by r.Id into GroupedData
select new
{
//what to put here
};
foreach(var crs in studIds)
{
//what to put here to get all student names from the Detail property.
}
Is there another way?