private GroupUpdateRuleCollection AddChildrenOf(GroupUpdateRule rule, bool recursive) { GroupUpdateRuleCollection uc = new GroupUpdateRuleCollection(); // Loop through the collection and determine if the current rule is a child of the current rule foreach (GroupUpdateRule ur in this.List) { if (ur.parentcomputergroup != null && rule.computergroup.Id == ur.parentcomputergroup.Id) { // Found one - add it to the collection. uc.Add(ur); // Are we recursively adding children? if (recursive) { // Yes, also add all the children of this child node uc.Add(AddChildrenOf(ur, true)); } } } return(uc); }
private GroupUpdateRuleCollection AddChildrenOf(GroupUpdateRule rule, bool recursive) { GroupUpdateRuleCollection uc = new GroupUpdateRuleCollection(); // Loop through the collection and determine if the current rule is a child of the current rule foreach (GroupUpdateRule ur in this.List) { if (ur.parentcomputergroup != null && rule.computergroup.Id == ur.parentcomputergroup.Id) { // Found one - add it to the collection. uc.Add(ur); // Are we recursively adding children? if (recursive) // Yes, also add all the children of this child node uc.Add(AddChildrenOf(ur, true)); } } return uc; }