Example #1
0
        internal VirtualSettingSection Merge(SettingSection other)
        {
            if (!Equals(other))
            {
                throw new ArgumentException(Resources.Error_MergeTwoDifferentSections);
            }

            foreach (var item in other.Items.Where(item => item != null))
            {
                if (item is ClearItem)
                {
                    if (CanBeCleared)
                    {
                        ChildrenSet.Clear();
                    }

                    ChildrenSet.Add(item, item);

                    continue;
                }

                if (ChildrenSet.ContainsKey(item))
                {
                    if (item is UnknownItem unknown)
                    {
                        unknown.Merge(ChildrenSet[item] as UnknownItem);
                    }

                    item.MergedWith   = ChildrenSet[item];
                    ChildrenSet[item] = item;
                }
                else
                {
                    ChildrenSet.Add(item, item);
                }
            }

            return(this);
        }
 public void ClearChildren()
 {
     Children.Clear();
     ChildrenSet.Clear();
 }