Created
November 29, 2018 13:48
-
-
Save Macadoshis/2ab805f14bf9b5ad6413fe597988a8ed to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| namespace CMSS.Domain.Base | |
| { | |
| public abstract class PairItemDom<T> : IEquatable<PairItemDom<T>> | |
| { | |
| protected PairItemDom() : this(null, default(T)) | |
| { | |
| } | |
| protected PairItemDom(int? refId, T refValue) | |
| { | |
| this.RefId = refId; | |
| this.RefValue = refValue; | |
| } | |
| public int? RefId { get; set; } | |
| public T RefValue { get; set; } | |
| public bool Equals(PairItemDom<T> other) | |
| { | |
| if (ReferenceEquals(null, other)) return false; | |
| if (ReferenceEquals(this, other)) return true; | |
| return RefId == other.RefId; | |
| } | |
| public override bool Equals(object obj) | |
| { | |
| if (ReferenceEquals(null, obj)) return false; | |
| if (ReferenceEquals(this, obj)) return true; | |
| if (obj.GetType() != this.GetType()) return false; | |
| return Equals((PairItemDom<T>)obj); | |
| } | |
| public override int GetHashCode() | |
| { | |
| return RefId.GetHashCode(); | |
| } | |
| public static bool AreObjectsEqual(PairItemDom<T> o, PairItemDom<T> o2) | |
| { | |
| if (o == null && o2 == null) | |
| { | |
| return true; | |
| } | |
| if (o == null || o2 == null) | |
| { | |
| return false; | |
| } | |
| return o.Equals(o2); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment