I have the following object:
public class Row
{
public int Id {get; set;}
public string Name {get; set;}
public Dictionary<Column, Cell> Cells {get; set;} = new Dictionary<Column, Cell>();
}
public class Cell
{
// ...
public string Value {get; set;}
}
Having a List of Rows, how can I remove all duplicates (by comparing cell's values)?
I tried adding the following:
public class RowEqualitycomparer : IEqualityComparer<Row>
{
public bool Equals(Row a, Row b)
{
return a.Cells.Equals(b.Cells);
}
public int GetHashCode(Row obj)
{
return obj.GetHashCode();
}
}