There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Improve Equals Method and IEquatable<>
(This is a report of an issue posted by BigstickCarpet)
There are two Equals methods on the Azumuth struct; one for the generic Object.Equals implementation and one for the IEquatable<T> implementation. The IEquatable<T> implemenation calls the Object.Equals implemenation, but it passes the DecimalDegrees
property value rather than the entire Azumuth struct. As a result, the Object.Equals method always returns false, since the parameter it receives is not an Azumuth instance.
One way to correct this is to change the IEquatable<T> method to pass the entire Azimuth struct to Object.Equals rather than just the DecimalDegrees property. Another option is to leave the IEquatable<T> method as-is and make the Object.Equals method
smart enough to handle either value. For example, the Object.Equals method could be implemented as follows:
public override bool Equals(object obj)
// Convert objects to an Azimuth as needed before comparison
if (obj is Azimuth)
// Compare degree value