public static List <IElement> SearchIElement(IElement rootElement, AbstractSearchCondition condition) { List <IElement> re = new List <IElement>(); DoSearch(rootElement, condition, ref re); return(re); }
private static void DoSearch(IElement element, AbstractSearchCondition condition, ref List <IElement> re) { if (element == null) { return; } if (condition.IsSatisfiable(element)) { re.Add(element); } if (element.Children != null && element.Children.Count > 0) { foreach (IElement child in element.Children) { DoSearch(child, condition, ref re); } } }