Exemplo n.º 1
0
            private static bool CompareEnumerables(Type enumerable, object x, object y)
            {
                Type        elementType = enumerable.GenericTypeArguments.First();
                IEnumerator xs          = ((IEnumerable)x).GetEnumerator();
                IEnumerator ys          = ((IEnumerable)y).GetEnumerator();

                IEqualityComparer elementComparer = new DynamicModelComparer(elementType);

                xs.Reset();
                ys.Reset();

                while (xs.MoveNext())
                {
                    if (!ys.MoveNext())
                    {
                        return(false);
                    }

                    if (!elementComparer.Equals(xs.Current, ys.Current))
                    {
                        return(false);
                    }
                }

                return(true);
            }
Exemplo n.º 2
0
            private static bool CompareRecursive(Type type, object x, object y)
            {
                IEqualityComparer comparer = new DynamicModelComparer(type);

                return(comparer.Equals(x, y));
            }
Exemplo n.º 3
0
            private bool CompareRecursive(Type type, object x, object y)
            {
                IEqualityComparer comparer = new DynamicModelComparer(type, AreBothNull, ShouldIgnoreProperty);

                return(comparer.Equals(x, y));
            }