/// <summary> /// Determines whether the specified PropertyInstanceValueData is equal to the current PropertyInstanceValueData. /// </summary> /// <param name="that">The PropertyInstanceValueData to compare with the current object.</param> /// <returns>Returns true if the specified object has the same value type and same vale as the current PropertyInstanceValueData; otherwise false.</returns> public virtual bool Equals(PropertyInstanceValueData that) { // if that is null - not equal if (ReferenceEquals(that, null)) { return(false); } // if that is has same reference to me - equal if (ReferenceEquals(this, that)) { return(true); } // if that has a different value type than me - not equal if (ValueType != that.ValueType) { return(false); } // finally - if that has the same actual value as me - equal (otherwise, not equal) switch (ValueType) { case ValueTypeDefinitionData.Reference: return(ReferenceValue.Equals(that.ReferenceValue)); case ValueTypeDefinitionData.DateTime: return(DateTimeValue.Equals(that.DateTimeValue)); case ValueTypeDefinitionData.Bool: return(BoolValue == that.BoolValue); case ValueTypeDefinitionData.Float: return(FloatValue == that.FloatValue); case ValueTypeDefinitionData.Int: return(IntValue == that.IntValue); case ValueTypeDefinitionData.StringNonUnicode: return(StringNonUnicodeValue.Equals(that.StringNonUnicodeValue)); default: return(false); } }
/// <summary> /// Determines whether the specified PropertyInstanceValueData is equal to the current PropertyInstanceValueData. /// </summary> /// <param name="that">The PropertyInstanceValueData to compare with the current object.</param> /// <returns>Returns true if the specified object has the same value type and same vale as the current PropertyInstanceValueData; otherwise false.</returns> public virtual bool Equals(PropertyInstanceValueData that) { // if that is null - not equal if (ReferenceEquals(that, null)) { return false; } // if that is has same reference to me - equal if (ReferenceEquals(this, that)) { return true; } // if that has a different value type than me - not equal if (ValueType != that.ValueType) { return false; } // finally - if that has the same actual value as me - equal (otherwise, not equal) switch (ValueType) { case ValueTypeDefinitionData.Reference: return ReferenceValue.Equals(that.ReferenceValue); case ValueTypeDefinitionData.DateTime: return DateTimeValue.Equals(that.DateTimeValue); case ValueTypeDefinitionData.Bool: return BoolValue == that.BoolValue; case ValueTypeDefinitionData.Float: return FloatValue == that.FloatValue; case ValueTypeDefinitionData.Int: return IntValue == that.IntValue; case ValueTypeDefinitionData.StringNonUnicode: return StringNonUnicodeValue.Equals(that.StringNonUnicodeValue); default: return false; } }