CodeCommentStatementCollection.AddRange 方法

定义

将指定的 CodeCommentStatement 数组的元素复制到集合末尾。

重载

AddRange(CodeCommentStatement[])

将指定的 CodeCommentStatement 数组的元素复制到集合末尾。

AddRange(CodeCommentStatementCollection)

将另一个 CodeCommentStatementCollection 对象的内容复制到集合的末尾。

AddRange(CodeCommentStatement[])

Source:
CodeCommentStatementCollection.cs
Source:
CodeCommentStatementCollection.cs
Source:
CodeCommentStatementCollection.cs

将指定的 CodeCommentStatement 数组的元素复制到集合末尾。

public void AddRange (System.CodeDom.CodeCommentStatement[] value);

参数

value
CodeCommentStatement[]

CodeCommentStatement 类型的数组,其中包含要添加到集合中的对象。

例外

valuenull

示例

下面的示例演示如何使用 AddRange(CodeCommentStatement[]) 方法重载将数组的成员CodeCommentStatement添加到 。CodeCommentStatementCollection

// 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 );

另请参阅

适用于

AddRange(CodeCommentStatementCollection)

Source:
CodeCommentStatementCollection.cs
Source:
CodeCommentStatementCollection.cs
Source:
CodeCommentStatementCollection.cs

将另一个 CodeCommentStatementCollection 对象的内容复制到集合的末尾。

public void AddRange (System.CodeDom.CodeCommentStatementCollection value);

参数

value
CodeCommentStatementCollection

一个 CodeCommentStatementCollection,其中包含要添加到集合中的对象。

例外

valuenull

示例

下面的示例演示如何使用 AddRange(CodeCommentStatementCollection) 方法重载将成员添加到另一个 CodeCommentStatementCollection 成员。

// 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 );

另请参阅

适用于