Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected bool Equals(Record other)
- {
- return Value == other.Value;
- }
- public override bool Equals(object obj)
- {
- if (ReferenceEquals(null, obj)) return false;
- if (ReferenceEquals(this, obj)) return true;
- return obj.GetType() == GetType() && Equals((Record) obj);
- }
- public override int GetHashCode()
- {
- return Value.GetHashCode();
- }
- public int CompareTo(Record other)
- {
- if (this > other) return 1;
- if (this < other) return -1;
- return 0;
- }
- public static bool operator ==(Record r1, Record r2)
- {
- return Equals(r1,r2);
- }
- public static bool operator !=(Record r1, Record r2)
- {
- return !(r1 == r2);
- }
- public static bool operator >(Record r1, Record r2)
- {
- var i1 = r1.IsInteger();
- var i2 = r2.IsInteger();
- if ((i1 && i2) || (!i1 && !i2))
- {
- return r1.Value > r2.Value;
- }
- return r1.IsInteger();
- }
- public static bool operator <(Record r1, Record r2)
- {
- return !(r1 >= r2);
- }
- public static bool operator <=(Record r1, Record r2)
- {
- return (r1 < r2 || r1 == r2);
- }
- public static bool operator >=(Record r1, Record r2)
- {
- return (r1 > r2 || r1 == r2);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement