Tag: 不同的

通过列表中的两个属性选择distinct

我有一个list ,其中包含Guid和DateTime类型的属性(以及其他属性)。 我想摆脱该列表中Guid和DateTime相同的所有项目(除了一个)。 有时这两个属性将与列表中的其他项相同,但其他属性将不同,所以我不能只使用.Distinct() List messages = GetList(); //The list now contains many objects, it is ordered by the DateTime property messages = from p in messages.Distinct( what goes here? ); 这就是我现在所拥有的,但似乎应该有更好的方法 List messages = GetList(); for(int i = 0; i < messages.Count() – 1) //use Messages.Count() -1 because the last one has nothing after […]