markus / ConvertService / ServiceBase / Markus.Service.Extensions / Helper / ConvertItemComparer.cs @ b92f142f
이력 | 보기 | 이력해설 | 다운로드 (919 Bytes)
1 | b92f142f | taeseongkim | using Markus.Service.Interface; |
---|---|---|---|
2 | using System; |
||
3 | using System.Collections.Generic; |
||
4 | using System.Linq; |
||
5 | using System.Text; |
||
6 | using System.Threading.Tasks; |
||
7 | |||
8 | namespace Markus.Service.Helper |
||
9 | { |
||
10 | public class ConvertItemComparer : IEqualityComparer<ConvertItem> |
||
11 | { |
||
12 | public bool Equals(ConvertItem x, ConvertItem y) |
||
13 | { |
||
14 | if (Object.ReferenceEquals(x, y)) return true; |
||
15 | |||
16 | if (Object.ReferenceEquals(x, null) || Object.ReferenceEquals(y, null)) |
||
17 | return false; |
||
18 | |||
19 | return x.ConvertID == y.ConvertID && x.ProjectNumber == y.ProjectNumber; |
||
20 | } |
||
21 | |||
22 | |||
23 | public int GetHashCode(ConvertItem convertItem) |
||
24 | { |
||
25 | var id = (convertItem.ConvertID != null) ? convertItem.ConvertID : ""; |
||
26 | var project = (convertItem.ProjectNumber != null) ? convertItem.ProjectNumber : ""; |
||
27 | |||
28 | return (id + project).GetHashCode(); |
||
29 | } |
||
30 | } |
||
31 | } |