namespace EasyLayoutNS { /// /// Position. /// public struct EasyLayoutPosition : System.IEquatable { /// /// X. /// public readonly int X; /// /// Y. /// public readonly int Y; /// /// Initializes a new instance of the struct. /// /// X. /// Y. public EasyLayoutPosition(int x, int y) { X = x; Y = y; } /// public override string ToString() { return string.Format("[{0}, {1}]", X.ToString(), Y.ToString()); } /// /// Determines whether the specified object is equal to the current object. /// /// The object to compare with the current object. /// true if the specified object is equal to the current object; otherwise, false. public override bool Equals(object obj) { if (obj is EasyLayoutPosition) { return Equals((EasyLayoutPosition)obj); } return false; } /// /// Determines whether the specified object is equal to the current object. /// /// The object to compare with the current object. /// true if the specified object is equal to the current object; otherwise, false. public bool Equals(EasyLayoutPosition other) { return X == other.X && Y == other.Y; } /// /// Hash function. /// /// A hash code for the current object. public override int GetHashCode() { return X ^ Y; } /// /// Compare specified instances. /// /// Left instance. /// Right instances. /// true if the instances are equal; otherwise, false. public static bool operator ==(EasyLayoutPosition left, EasyLayoutPosition right) { return left.Equals(right); } /// /// Compare specified instances. /// /// Left instance. /// Right instances. /// true if the instances are now equal; otherwise, false. public static bool operator !=(EasyLayoutPosition left, EasyLayoutPosition right) { return !left.Equals(right); } } }