/// <summary> /// Determines whether the specified PropertyInstanceData is equal to the current PropertyInstanceData. /// </summary> /// <param name="that">The PropertyInstanceData to compare with the current object.</param> /// <returns>Returns true if the specified object has the same DefinitionName and the same values /// (using the PropertyInstanceValueData Equals method) as the current PropertyInstanceValueData; /// otherwise false.</returns> public virtual bool Equals(PropertyInstanceData that) { // if data is null - not equal if (ReferenceEquals(that, null)) { return(false); } // if data is has same reference to me - equal if (ReferenceEquals(this, that)) { return(true); } // otherwise do comparison logic here // First check it's the same definition name if (!DefinitionName.Equals(that.DefinitionName)) { return(false); } // Second, check it's the same number of values if (Values.Length != that.Values.Length) { return(false); } // Last check it's the same exact values return(!Values.Except(that.Values).Any()); }
/// <summary> /// Determines whether the specified PropertyInstanceData is equal to the current PropertyInstanceData. /// </summary> /// <param name="that">The PropertyInstanceData to compare with the current object.</param> /// <returns>Returns true if the specified object has the same DefinitionName and the same values /// (using the PropertyInstanceValueData Equals method) as the current PropertyInstanceValueData; /// otherwise false.</returns> public virtual bool Equals(PropertyInstanceData that) { // if data is null - not equal if (ReferenceEquals(that, null)) { return false; } // if data is has same reference to me - equal if (ReferenceEquals(this, that)) { return true; } // otherwise do comparison logic here // First check it's the same definition name if (!DefinitionName.Equals(that.DefinitionName)) { return false; } // Second, check it's the same number of values if (Values.Length != that.Values.Length) { return false; } // Last check it's the same exact values return !Values.Except(that.Values).Any(); }