Ejemplo n.º 1
0
            /// more than ten times faster than SequenceEquals
            public static bool ListsAreEqual <T>(List <T> a, List <T> b)
            {
                // if both are null, ReferenceEquals returns true
                if (Object.ReferenceEquals(a, b))
                {
                    return(true);
                }

                if (a == null || b == null)
                {
                    return(false);
                }

                if (a.Count != b.Count)
                {
                    return(false);
                }

                //EqualityComparer<T> comparer = EqualityComparer<T>.Default;
                //return !b1.Where((t, i) => !comparer.Equals(t, b2[i])).Any();

                for (int i = 0; i < a.Count; ++i)
                {
                    T ai = a[i];
                    T bi = b[i];

                    bool bEqual = OperationUtils.Compare(ai, bi, EOperatorType.E_EQUAL);
                    if (!bEqual)
                    {
                        return(false);
                    }
                }

                return(true);
            }
Ejemplo n.º 2
0
 public static bool TypesEquals <T>(T a, T b)
 {
     return(OperationUtils.Compare(a, b, EOperatorType.E_EQUAL));
 }