Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class MyReferenceType : IEquatable<MyReferenceType>, IComparable, IComparable<MyReferenceType>
- {
- public int Property1 { get; private set; }
- public int Property2 { get; private set; }
- public int Property3 { get; private set; }
- public int Property4 { get; private set; }
- public int Property5 { get; private set; }
- public int Property6 { get; private set; }
- public MyReferenceType(int property1, int property2, int property3, int property4, int property5, int property6)
- {
- Property1 = property1;
- Property2 = property2;
- Property3 = property3;
- Property4 = property4;
- Property5 = property5;
- Property6 = property6;
- }
- #region Equality
- public bool Equals(MyReferenceType obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- return obj.Property2 == Property2;
- }
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != typeof(MyReferenceType)) return false;
- return ((MyReferenceType)obj).Property1.Equals(Property1);
- }
- public override int GetHashCode()
- {
- unchecked
- {
- return Property3.GetHashCode();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement