public partial class V_MyJoinedCloudRespository
{
public List<V_MyJoinedCloud> GetDistinctJoinedCloud(string cloudName,long ExpertId)
{ var lamd = from p in db.V_MyJoinedCloud where p.Status == 1 && p.CompanyName.Contains(cloudName) && p.ExpertID==ExpertId select p;List<V_MyJoinedCloud> list = new List<V_MyJoinedCloud>();
if (lamd!=null&&lamd.Count()>0) { list = lamd.ToList(); list = list.Distinct(new CompanyNameComparer()).ToList(); } return list; }}
public class CompanyNameComparer : IEqualityComparer<V_MyJoinedCloud>
{ public bool Equals(V_MyJoinedCloud x, V_MyJoinedCloud y) { if (x == null) return y == null; return x.CompanyID == y.CompanyID; }public int GetHashCode(V_MyJoinedCloud obj)
{ if (obj == null) return 0; return obj.CompanyID.GetHashCode(); } }