I would like to know how to achieve grouping and eliminating repeated data, for example I have this class:
public class MyObject
{
public string attrb1{ get; set; }
public string attrb2{ get; set; }
}
and I want to "debug" the repeated objects, try the following, but it does not work.
List<MyObject> ListObject = new List<MyObject>();
var obj1 = new MyObject{attrb1="attrb1", attrb2="attrb2"}
ListObject.Add(obj1);
var obj2 = new MyObject{attrb1="attrb1", attrb2="attrb2"}
ListObject.Add(obj2);
List<MyObject> GroupedList= new List<MyObject>();
foreach(var obj in ListObject)
{
if(!GroupedList.Contains(obj))
GroupedList.Add(obj);
}