public PropertyCollection Clone() { List <Property> clonedProperties = new List <Property>(); foreach (Property property in this.Properties) { Property clonedProperty = property.Clone(); clonedProperties.Add(clonedProperty); } List <PropertyCollectionRule> clonedRules = new List <PropertyCollectionRule>(); foreach (PropertyCollectionRule rule in this.rules) { PropertyCollectionRule clonedRule = rule.Clone(); clonedRules.Add(clonedRule); } return(new PropertyCollection(clonedProperties, clonedRules)); }
private void Initialize( IEnumerable <Property> properties, IEnumerable <PropertyCollectionRule> rules) { foreach (Property property in properties) { Property propertyClone = property.Clone(); this.properties.Add(propertyClone.Name, propertyClone); } foreach (PropertyCollectionRule rule in rules) { PropertyCollectionRule ruleClone = rule.Clone(); this.rules.Add(ruleClone); } foreach (PropertyCollectionRule rule in this.rules) { rule.Initialize(this); } HookUpEvents(); }