/// <summary> /// Performs a value equality check on the values in LHS and RHS described by this field. /// </summary> /// <param name="leftContext">Left context object</param> /// <param name="rightContext">Right context object</param> /// <returns>True if the values described by each context are the same</returns> public bool ContextSimplEquals(object leftContext, object rightContext) { var leftSideDescribedValue = this.GetValue(leftContext); var rightSideDescribedValue = this.GetValue(rightContext); if (leftSideDescribedValue.GetType().Equals(rightSideDescribedValue.GetType())) { if (this.IsComposite) { var compositetype = new CompositeType(leftSideDescribedValue.GetType()); return(compositetype.SimplEquals(leftSideDescribedValue, rightSideDescribedValue)); } else if (this.IsCollection) { return(CollectionType.SimplEquals(leftSideDescribedValue, rightSideDescribedValue)); } else if (this.IsScalar) { return(this.ScalarType.SimplEquals(leftSideDescribedValue, rightSideDescribedValue)); } else { throw new Exception("Unexpected type found at ContextSimplEquals!"); } } else { return(false); } }