Пример #1
0
        /// <summary>
        /// Returns true if <paramref name="a"/> and <paramref name="b"/> are equal.
        /// </summary>
        /// <param name="a">The first object</param>
        /// <param name="b">The second object</param>
        /// <returns>true if <paramref name="a"/> and <paramref name="b"/> are equal.</returns>
        public static bool AreEqual(ColumnSet a, ColumnSet b)
        {
            if (a == null && b == null)
            {
                return(true);
            }
            if (a != null || b != null)
            {
                return(false);
            }
            if (a.Equals(b))
            {
                return(true);
            }

            if (a.AllColumns != b.AllColumns)
            {
                return(false);
            }
            if (a.Columns == null && b.Columns != null)
            {
                return(false);
            }
            if (a.Columns != null && b.Columns == null)
            {
                return(false);
            }
            if (a.Columns.Count != b.Columns.Count)
            {
                return(false);
            }

            for (var i = 0; i < a.Columns.Count; i++)
            {
                if (!string.Equals(a.Columns[i], b.Columns[i]))
                {
                    return(false);
                }
            }

            return(true);
        }