The model is often used in c # programming, and the list is often used to store entity sets. Therefore, various list operations are designed, and list sorting and searching are common, comparison, deduplication. In general, if you want to repeat the list, if you use the linq distinct method, you will encounter some pitfalls and find that duplicate data still exists in the result set, the reason is that this method is used to deduplicate object references and does not meet our needs. Therefore, this article uses the c # proxy method to perform the list distinct operation. First, we will introduce the traditional method of repeat the list. The Code is as follows: List <ReviewersReport> reportList = GetReportList (); for (int I = 0; I <reportList. count; I ++) {for (int j = I + 1; j <reportList. count; j ++) {if (reportList [I]. equals (reportList [j]) {reportList. removeAt (reportList. lastIndexOf (reportList [I]); j -- ;}} using this method to perform the distinct operation on the list is obviously troublesome, if other list entity sets need to implement similar functions, we will worry about code reusability. The following describes how to implement the list distinct function in a simple and efficient way. It is also recommended in this article to create a Compare class first, as shown below: public delegate bool extends scomparer <T> (T x, T y); public class Compare <T>: IEqualityComparer <T> {private extends scomparer <T> _ extends scomparer; public Compare (extends scomparer <T> extends scomparer) {this. _ ipvscomparer = ipvscomparer;} public bool Equals (T x, T y) {if (null! = This. _ ipvscomparer) return this. _ ipvscomparer (x, y); else return false;} public int GetHashCode (T obj) {return obj. toString (). getHashCode () ;}} a delegate is passed in the constructor. The caller can define a comparison rule in this delegate, which provides great flexibility, we can note that Compare implements the IEqualityComparer interface to define comparison objects and determine whether the two objects are equal. Usage: ist <ReviewersReport> requestList = Get RequestList (); requestList = requestList. Distinct (new Compare <Requestor> (x, y) => (null! = X & null! = Y) & (x. requestorName. equals (y. requestorName )))). toList (); this method greatly extends the usage range of the comparator, increases the reusability of the code, and can be applied to the comparison of any object. After comparison, we can sort the scripts to make the code concise. View Code