コード例 #1
0
 private static void RemoveXmlDocumentation(CodeCommentStatementCollection comments)
 {
     for (int i = 0; i < comments.Count; i++)
     {
         if (comments[i].Comment.DocComment)
         {
             comments.RemoveAt(i);
             i -= 1;
         }
     }
 }
コード例 #2
0
 private static void AddComments(CodeTypeMember completeProperty, CodeCommentStatementCollection comments, bool readOnly)
 {
     if (!readOnly)
     {
         for (int i = comments.Count - 2; i >= 1; i--)
         {
             string comment = comments[i].Comment.Text;
             if (comment == "<summary>" || comment == "</summary>" || comment.StartsWith("<para>See also "))
             {
                 comments.RemoveAt(i);
             }
         }
     }
     completeProperty.Comments.AddRange(comments);
 }
コード例 #3
0
        protected void ReplaceComment(CodeCommentStatementCollection collection, string value, bool docComment)
        {
            int i = 0;

            while (i < collection.Count)
            {
                if (collection[i].Comment.DocComment != docComment)
                {
                    i++;
                }
                else
                {
                    collection.RemoveAt(i);
                }
            }

            string[] strings = value.Split('\n');
            for (i = 0; i < strings.Length; i++)
            {
                collection.Add(new CodeCommentStatement(new CodeComment(strings[i], docComment)));
            }
        }
コード例 #4
0
ファイル: class1.cs プロジェクト: zhamppx97/dotnet-api-docs
        // CodeCommentStatementCollection
        public void CodeCommentStatementCollectionExample()
        {
            //<Snippet1>
            //<Snippet2>
            // Creates an empty CodeCommentStatementCollection.
            CodeCommentStatementCollection collection = new CodeCommentStatementCollection();

            //</Snippet2>

            //<Snippet3>
            // Adds a CodeCommentStatement to the collection.
            collection.Add(new CodeCommentStatement("Test comment"));
            //</Snippet3>

            //<Snippet4>
            // Adds an array of CodeCommentStatement objects to the collection.
            CodeCommentStatement[] comments = { new CodeCommentStatement("Test comment"), new CodeCommentStatement("Another test comment") };
            collection.AddRange(comments);

            // Adds a collection of CodeCommentStatement objects to the collection.
            CodeCommentStatementCollection commentsCollection = new CodeCommentStatementCollection();

            commentsCollection.Add(new CodeCommentStatement("Test comment"));
            commentsCollection.Add(new CodeCommentStatement("Another test comment"));
            collection.AddRange(commentsCollection);
            //</Snippet4>

            //<Snippet5>
            // Tests for the presence of a CodeCommentStatement in the
            // collection, and retrieves its index if it is found.
            CodeCommentStatement testComment = new CodeCommentStatement("Test comment");
            int itemIndex = -1;

            if (collection.Contains(testComment))
            {
                itemIndex = collection.IndexOf(testComment);
            }
            //</Snippet5>

            //<Snippet6>
            // Copies the contents of the collection, beginning at index 0,
            // to the specified CodeCommentStatement array.
            // 'comments' is a CodeCommentStatement array.
            collection.CopyTo(comments, 0);
            //</Snippet6>

            //<Snippet7>
            // Retrieves the count of the items in the collection.
            int collectionCount = collection.Count;

            //</Snippet7>

            //<Snippet8>
            // Inserts a CodeCommentStatement at index 0 of the collection.
            collection.Insert(0, new CodeCommentStatement("Test comment"));
            //</Snippet8>

            //<Snippet9>
            // Removes the specified CodeCommentStatement from the collection.
            CodeCommentStatement comment = new CodeCommentStatement("Test comment");

            collection.Remove(comment);
            //</Snippet9>

            //<Snippet10>
            // Removes the CodeCommentStatement at index 0.
            collection.RemoveAt(0);
            //</Snippet10>
            //</Snippet1>
        }
コード例 #5
0
ファイル: MethodsGenerator.cs プロジェクト: KDE/assemblygen
 private static void AddComments(CodeTypeMember completeProperty, CodeCommentStatementCollection comments, bool readOnly)
 {
     if (!readOnly)
     {
         for (int i = comments.Count - 2; i >= 1; i--)
         {
             string comment = comments[i].Comment.Text;
             if (comment == "<summary>" || comment == "</summary>" || comment.StartsWith("<para>See also "))
             {
                 comments.RemoveAt(i);
             }
         }
     }
     completeProperty.Comments.AddRange(comments);
 }