/// <summary> /// Gets an empty collection on which the Merge() /// method may be called to merge in data from /// other BrokenRuleCollection objects. /// </summary> public static BrokenRulesCollection CreateCollection() { BrokenRulesCollection result = new BrokenRulesCollection(); result._customList = true; return(result); }
/// <summary> /// Merges data from the supplied list into this /// list, changing the rule names to be unique /// based on the source value. /// </summary> /// <param name="source"> /// A unique source name for each list being /// merged into this master list. /// </param> /// <param name="list"> /// A list to merge into this master list. /// </param> /// <remarks> /// This method is intended to allow merging of /// all BrokenRulesCollection objects in a business /// object graph into a single list. To this end, /// no attempt is made to remove duplicates during /// the merge process. Also, the source parameter /// value must be unqiue for each object instance /// in the graph, or rule name collisions may /// occur. /// </remarks> public void Merge(string source, BrokenRulesCollection list) { if (!_customList) { throw new NotSupportedException(Resources.BrokenRulesMergeException); } IsReadOnly = false; foreach (BrokenRule item in list) { BrokenRule newItem = new BrokenRule(source, item); IncrementCount(newItem); Add(newItem); } IsReadOnly = true; }