示例#1
0
        /// <summary>
        /// Returns the first similar FeedColumnLayout key (ignoring the
        /// ColumnWidths).
        /// </summary>
        /// <param name="layout">FeedColumnLayout</param>
        /// <returns>key or null if not found</returns>
        public string KeyOfSimilar(FeedColumnLayout layout)
        {
            if (layout == null)
            {
                return(null);
            }
            FeedColumnLayoutComparer comparer = Comparer;

            foreach (string key in Keys)
            {
                if (!ReferenceEquals(this[key], layout) && comparer.Equals(this[key], layout))
                {
                    return(key);
                }
            }
            return(null);
        }
示例#2
0
        /// <summary>
        /// Removes all similar layouts.
        /// </summary>
        /// <param name="layout">The layout.</param>
        public void RemoveSimilarLayouts(FeedColumnLayout layout)
        {
            if (layout == null)
            {
                return;
            }
            FeedColumnLayoutComparer comparer = Comparer;
            List <string>            toRemove = new List <string>();

            foreach (string key in Keys)
            {
                if (!ReferenceEquals(this[key], layout) && comparer.Equals(this[key], layout))
                {
                    toRemove.Add(key);
                }
            }

            for (int i = 0; i < toRemove.Count; i++)
            {
                string key = toRemove[0];
                Remove(key);
            }
        }