Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public abstract class ValueObject
- {
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(obj, null))
- {
- return false;
- }
- return StructuralComparer.AreEqual(this, obj);
- }
- public override int GetHashCode()
- {
- return StructuralHashCodeCalculator.CalculateHashCode(this);
- }
- public static bool operator ==(ValueObject a, ValueObject b)
- {
- if (ReferenceEquals(a, null) && ReferenceEquals(b, null))
- {
- return true;
- }
- if (ReferenceEquals(a, null) || ReferenceEquals(b, null))
- {
- return false;
- }
- return a.Equals(b);
- }
- public static bool operator !=(ValueObject a, ValueObject b)
- {
- return !(a == b);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement