Example #1
0
        /// <summary>
        /// Update the settings using the given source. If the ignoreChain flag is true
        /// (the default), this composer is updated without regard to the contents of its
        /// parents. If the ignoreChain is false, only items not present in the chain
        /// (meaning both key and value per item) are modified in this composer.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="ignoreChain"></param>
        /// <returns></returns>
        public SettingsComposer UpdateFrom(SettingsComposer source, bool ignoreChain = true)
        {
            var newSource =
                ignoreChain
                ? source
                : source.Where(item => ChainContains(item.Key, item.Value) == false);

            foreach (var item in newSource)
            {
                this[item.Key] = item.Value;
            }

            return(this);
        }