예제 #1
0
        private static bool PropertyValueEquals(object value1, object value2)
        {
            if (object.Equals(value1, value2))
            {
                return(true);
            }
            if (value1 is Enum || value2 is Enum)
            {
                IConvertible convertible  = value1 as IConvertible;
                IConvertible convertible2 = value2 as IConvertible;
                if (convertible != null && convertible2 != null)
                {
                    try
                    {
                        ulong num  = convertible.ToUInt64(null);
                        ulong num2 = convertible2.ToUInt64(null);
                        return(num == num2);
                    }
                    catch (OverflowException)
                    {
                    }
                    catch (FormatException)
                    {
                        return(false);
                    }
                    try
                    {
                        long num3 = convertible.ToInt64(null);
                        long num4 = convertible2.ToInt64(null);
                        return(num3 == num4);
                    }
                    catch (OverflowException)
                    {
                        return(false);
                    }
                    catch (FormatException)
                    {
                        return(false);
                    }
                    return(false);
                }
                return(false);
            }
            IList list  = value1 as IList;
            IList list2 = value2 as IList;

            if (list != null && list2 != null)
            {
                bool flag = list2.Count == list.Count;
                int  num5 = 0;
                while (flag && num5 < list.Count)
                {
                    flag = ComparisonFilter.PropertyValueEquals(list[num5], list2[num5]);
                    num5++;
                }
                return(flag);
            }
            return(false);
        }
예제 #2
0
        public override bool Equals(object obj)
        {
            ComparisonFilter comparisonFilter = obj as ComparisonFilter;

            return(comparisonFilter != null && this.comparisonOperator == comparisonFilter.comparisonOperator && comparisonFilter.GetType() == base.GetType() && ComparisonFilter.PropertyValueEquals(this.propertyValue, comparisonFilter.propertyValue) && base.Equals(obj));
        }