Simpl.Serialization.FieldDescriptor.ContextSimplEquals C# (CSharp) Метод

ContextSimplEquals() публичный Метод

Performs a value equality check on the values in LHS and RHS described by this field.
public ContextSimplEquals ( object leftContext, object rightContext ) : bool
leftContext object Left context object
rightContext object Right context object
Результат bool
        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;
            }
        }