In a list of SchematicElevation
objects how can I remove the ones with the same property using LINQ.
public class SchematicElevation
{
public double Elevation { get; set; }
public int ColumnId { get; set; }
}
var se1 = new SchematicElevation { ColumnId = 2, Elevation = 300 };
var se2 = new SchematicElevation { ColumnId = 3, Elevation = 300 };
var se3 = new SchematicElevation { ColumnId = 4, Elevation = 300 };
var se4 = new SchematicElevation { ColumnId = 4, Elevation = 300 };
var se5 = new SchematicElevation { ColumnId = 4, Elevation = 300 };
var SchematicElevations = new List<SchematicElevation> { se1, se2, se3, se4, se5}
The final result would be the list below:
List: {se1, se2, se3}
I would like doing this using LINQ and by using GroupBy.