|
|
@ -75,6 +75,29 @@ namespace LinqStudy.Test.LinqToObject
|
|
|
|
//特别注意:值对象,比较值本身。
|
|
|
|
//特别注意:值对象,比较值本身。
|
|
|
|
Assert.Equal(2, person.Count);
|
|
|
|
Assert.Equal(2, person.Count);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[Fact]
|
|
|
|
|
|
|
|
public void Test_3()
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
List<Person> perons1 = new List<Person> {
|
|
|
|
|
|
|
|
new Person { Id=1,Name="woody1"},
|
|
|
|
|
|
|
|
new Person { Id=2,Name="woody2"},
|
|
|
|
|
|
|
|
new Person { Id=3,Name="woody3"},
|
|
|
|
|
|
|
|
new Person { Id=4,Name="woody4"},
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<Person> perons2 = new List<Person> {
|
|
|
|
|
|
|
|
new Person { Id=3,Name="woody3"},
|
|
|
|
|
|
|
|
new Person { Id=4,Name="woody4"},
|
|
|
|
|
|
|
|
new Person { Id=5,Name="woody5"},
|
|
|
|
|
|
|
|
new Person { Id=6,Name="woody6"},
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
perons1.AddRange(perons2);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var cc= perons1.Distinct().ToList();
|
|
|
|
|
|
|
|
Assert.Equal(8,cc.Count);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|