I'm trying to remove the repeated course from the linq query below. When this query returns it returns multiples of the same course(s) but I would like for it to return unique courses. Can I use a hashset to make this list unique? Thanks for any help!
 foreach (var course in Model.Assignments
                             .Select((x, y) => new { Data = x, Index = y })
                             .Where(x => x.Data.Ids == listOfIds[i]))
 { 
    // code here 
 }
 
     
     
    