public IEnumerable <Comment> GetComments(SyntaxNode root, IEnumerable <KeyValuePair <string, int> > itemNames) { var comments = new List <Comment>(); ItemNames = itemNames; var commentLocatingVisitor = new CommentLocatingVisitor( comment => { if (_commentMatcher(comment.Name)) { comments.Add(comment); } } ); commentLocatingVisitor.Visit(root); return(comments); }
public IEnumerable <Comment> GetToDoComments(string content) { if (content == null) { throw new ArgumentException("content"); } var todoComments = new List <Comment>(); var commentLocatingVisitor = new CommentLocatingVisitor( comment => { if (_toDoCommentMatcher(comment.Content)) { todoComments.Add(comment); } } ); commentLocatingVisitor.Visit( CSharpSyntaxTree.ParseText(content).GetRoot() ); return(todoComments); }