示例#1
0
        /// <summary>
        ///     Clones this instance.
        /// </summary>
        /// <returns>A duplicated setting item.</returns>
        public SettingItem <T> Clone()
        {
            var item = new SettingItem <T>(Id, Action);

            foreach (var entry in this)
            {
                item.Add(entry.Key, entry.Value);
            }
            return(item);
        }
示例#2
0
        /// <summary>
        ///     Clones this instance.
        /// </summary>
        /// <returns>A duplicated rule.</returns>
        public Rule Clone()
        {
            var ret = new Rule();

            ret.Preset  = Preset;
            ret.Pattern = Pattern;
            ret.Inherit = Inherit;
            foreach (var i in this)
            {
                var item = new SettingItem <Protection>();
                item.Id     = i.Id;
                item.Action = i.Action;
                foreach (string j in i.Keys)
                {
                    item.Add(j, i[j]);
                }
                ret.Add(item);
            }
            return(ret);
        }