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

另请参阅

适用于

.NET Framework 4.8.1 和其他版本
产品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

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

另请参阅

适用于

.NET Framework 4.8.1 和其他版本
产品 版本
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9