我有一个清单如下:
public class MyClass
{
public int val1;
public long val2;
public string val3;
}
class Program
{
static void Main(string[] args)
{
List<MyClass> lstData=new List<MyClass>
{
new MyClass{val1=1,val2=2,val3="AA"},
new MyClass{val1=1,val2=2,val3="BB"},
new MyClass{val1=3,val2=4,val3="AA"},
new MyClass{val1=3,val2=4,val3="BB"},
new MyClass{val1=1,val2=2,val3="BB"},
new MyClass{val1=3,val2=4,val3="AA"},
};
}
}
我想从列表中获取唯一行。在上面的示例中,以下列表是重复的
{val1=1,val2=2,val3="BB"}
{val1=3,val2=4,val3="AA"}
我想消除重复的行并将不同的行从列表中取出。我怎么能这样做?