Linq Distinct 自定义比较

private class MyMenuComparer : IEqualityComparer

{

public bool Equals(ParMenu x, ParMenu y){ return x.parentColor == y.parentColor && x.parentMenu == y.parentMenu; }

public int GetHashCode(ParMenu obj) { return obj.parentMenu.Length; }

}

posted @ 2013-12-20 21:00  cn_king  阅读(239)  评论(0编辑  收藏  举报