コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }