现在有一个列表,类型List<entity>,有上万条数据。entity有很多属性,其中有两个属性,类型分别为Datetime date,int userid怎么实现,给定一个实体entity,依据date,userid,快速的在实体中查找是否包括给定的实体,判断的条件是:date,userid。

解决方案 »

  1.   


            public class bb :IEqualityComparer<entity>
            {
                #region IEqualityComparer<entity> Members            public bool Equals(entity x, entity y)
                {
    if(x.date == y.date)自己写吧
                    throw new NotImplementedException();
                }            public int GetHashCode(entity obj)
                {
                    throw new NotImplementedException();
                }            #endregion
            }
    List<entity > list = new List<entity >();           bb bc=new bb();
                
                list.Contains(entity,bc);