/// <summary> /// Tests whether the specified object is a <see cref="Size" /> and is equivalent to this <see cref="Size" />. /// </summary> /// <param name="obj">The object to test.</param> /// <returns><c>true</c> if <paramref name="obj" /> is a <see cref="Size" /> equivalent to this <see cref="Size" />; otherwise, <c>false</c>.</returns> public override bool Equals(object obj) { if (!(obj is Size)) { return(false); } Size compareSize = (Size)obj; return(((double.IsNaN(Width) && double.IsNaN(compareSize.Width)) || Width.EqualsInTolerance(compareSize.Width)) && ((double.IsNaN(Height) && double.IsNaN(compareSize.Height)) || Height.EqualsInTolerance(compareSize.Height))); }