Example #1
0
        /// <summary>Ensures set contain only elements that are present either in the current columns or in the specified columns, but not both.</summary>
        /// <param name="source">The current columns.</param>
        /// <param name="other">The columns to compare to the current columns.</param>
        /// <returns>A new set if there is any modification to current sealed set; otherwise, the current set.</returns>
        public static IColumns SymmetricExcept(this IColumns source, IColumns other)
        {
            source.VerifyNotNull(nameof(source));
            other.VerifyNotNull(nameof(other));

            IColumns removedColumnSet = Columns.Empty;

            foreach (var column in source)
            {
                if (other.Contains(column))
                {
                    removedColumnSet = removedColumnSet.Add(column);
                    source           = source.Remove(column);
                }
            }

            foreach (var column in other)
            {
                if (removedColumnSet.Contains(column))
                {
                    source = source.Add(column);
                }
            }

            return(source);
        }
Example #2
0
        /// <summary>Ensures set contain all elements that are present in either the current columns or in the specified columns.</summary>
        /// <param name="source">The current columns.</param>
        /// <param name="other">The collection to add elements from.</param>
        /// <returns>A new set if there is any modification to current set and current set sealed; otherwise, the current set.</returns>
        public static IColumns Union(this IColumns source, IColumns other)
        {
            source.VerifyNotNull(nameof(source));
            other.VerifyNotNull(nameof(other));

            foreach (var column in other)
            {
                source = source.Add(column);
            }
            return(source);
        }
Example #3
0
 internal void OnValueChanged(Column column)
 {
     if (IsValueChangedNotificationSuspended)
     {
         if (_pendingValueChangedColumns != null)
         {
             _pendingValueChangedColumns = _pendingValueChangedColumns.Add(column);
         }
         return;
     }
     NotifyValueChanged(column);
 }
Example #4
0
        /// <summary>
        /// Creates a new set of columns.
        /// </summary>
        /// <param name="values">The value of columns.</param>
        /// <returns>The column set.</returns>
        public static IColumns New(params Column[] values)
        {
            values.VerifyNotNull(nameof(values));

            if (values.Length == 0)
            {
                return(Empty);
            }

            IColumns result = values.VerifyNotNull(0, nameof(values));

            for (int i = 1; i < values.Length; i++)
            {
                result = result.Add(values.VerifyNotNull(i, nameof(values)));
            }
            return(result);
        }