ValeraT1982 / ObjectsComparer

C# Framework provides mechanism to compare complex objects, allows to override comparison rules for specific properties and types.
MIT License
354 stars 87 forks source link

Method `BaseComparer/AddComparerOverride` does not not override #17

Closed upper-link closed 4 years ago

upper-link commented 4 years ago

Because the internal method ComparerOverridesCollection/AddCompare throws an exception

        public void AddComparer(MemberInfo memberInfo, IValueComparer valueComparer
        {
            if (memberInfo == null)
            {
                throw new ArgumentNullException(nameof(memberInfo));
            }

            //if (_overridesByMember.ContainsKey(memberInfo))
            //{
            //    throw new ValueComparerExistsException(memberInfo);
            //}

            _overridesByMember[memberInfo] = valueComparer ?? throw new ArgumentNullException(nameof(valueComparer));
        }
ValeraT1982 commented 4 years ago

@Upper-Link, can you please provide your code? It throws exception if member has already been overwritten.