List에서 동일한 값이 있는지 확인 하고싶을때.
public static ListRoleList = new List (); public class Role : IEquatable { public short No { get; set; } public string Name { get; set; } public string Description { get; set; } public override int GetHashCode() { return No; } public override bool Equals(object obj) { return base.Equals(obj as Role); } public bool Equals(Role other) { return other != null && other.No == this.No; } }
'Development > C#' 카테고리의 다른 글
제네릭(Generic)과 제약조건 (0) | 2012.12.28 |
---|---|
IPAddress 가져오기 (0) | 2012.12.21 |
최상위 컨트롤 (0) | 2012.12.13 |
ClickOnce 삭제 (0) | 2012.12.13 |
Window Screen Capture (0) | 2012.08.23 |