public static List <INode> find <T>(this GetAllINodes getAllNodes, string propertyName, object value) where T : INode { var matches = new List <INode>(); var allByType = getAllNodes.allByType <T>(); foreach (var node in allByType) { var propValue = node.prop(propertyName); if (propValue != null && value != null && propValue.str().contains(value.str())) { matches.add(node); } } return(matches); }