CodeCatchClauseCollection.AddRange 方法

定义

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

重载

AddRange(CodeCatchClause[])

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

AddRange(CodeCatchClauseCollection)

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

AddRange(CodeCatchClause[])

Source:
CodeCatchClauseCollection.cs
Source:
CodeCatchClauseCollection.cs
Source:
CodeCatchClauseCollection.cs

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

public:
 void AddRange(cli::array <System::CodeDom::CodeCatchClause ^> ^ value);
public void AddRange (System.CodeDom.CodeCatchClause[] value);
member this.AddRange : System.CodeDom.CodeCatchClause[] -> unit
Public Sub AddRange (value As CodeCatchClause())

参数

value
CodeCatchClause[]

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

例外

valuenull

示例

以下示例演示如何使用 AddRange(CodeCatchClause[]) 方法重载将 对象数组CodeCatchClause的成员添加到 。CodeCatchClauseCollection

// Adds an array of CodeCatchClause objects to the collection.
array<CodeCatchClause^>^clauses = {gcnew CodeCatchClause,gcnew CodeCatchClause};
collection->AddRange( clauses );

// Adds a collection of CodeCatchClause objects to the collection.
CodeCatchClauseCollection^ clausesCollection = gcnew CodeCatchClauseCollection;
clausesCollection->Add( gcnew CodeCatchClause( "e",gcnew CodeTypeReference( System::ArgumentOutOfRangeException::typeid ) ) );
clausesCollection->Add( gcnew CodeCatchClause( "e" ) );
collection->AddRange( clausesCollection );
// Adds an array of CodeCatchClause objects to the collection.
CodeCatchClause[] clauses = { new CodeCatchClause(), new CodeCatchClause() };
collection.AddRange( clauses );

// Adds a collection of CodeCatchClause objects to the collection.
CodeCatchClauseCollection clausesCollection = new CodeCatchClauseCollection();
clausesCollection.Add( new CodeCatchClause("e", new CodeTypeReference(typeof(System.ArgumentOutOfRangeException))) );
clausesCollection.Add( new CodeCatchClause("e") );
collection.AddRange( clausesCollection );
' Adds an array of CodeCatchClause objects to the collection.
Dim clauses As CodeCatchClause() = {New CodeCatchClause(), New CodeCatchClause()}
collection.AddRange(clauses)

' Adds a collection of CodeCatchClause objects to the collection.
Dim clausesCollection As New CodeCatchClauseCollection()
clausesCollection.Add(New CodeCatchClause("e", New CodeTypeReference(GetType(System.ArgumentOutOfRangeException))))
clausesCollection.Add(New CodeCatchClause("e"))
collection.AddRange(clausesCollection)

另请参阅

适用于

AddRange(CodeCatchClauseCollection)

Source:
CodeCatchClauseCollection.cs
Source:
CodeCatchClauseCollection.cs
Source:
CodeCatchClauseCollection.cs

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

public:
 void AddRange(System::CodeDom::CodeCatchClauseCollection ^ value);
public void AddRange (System.CodeDom.CodeCatchClauseCollection value);
member this.AddRange : System.CodeDom.CodeCatchClauseCollection -> unit
Public Sub AddRange (value As CodeCatchClauseCollection)

参数

value
CodeCatchClauseCollection

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

例外

valuenull

示例

以下示例演示如何使用 AddRange(CodeCatchClauseCollection) 方法重载将一个对象的成员添加到另一个 CodeCatchClauseCollectionCodeCatchClauseCollection对象。

// Adds an array of CodeCatchClause objects to the collection.
array<CodeCatchClause^>^clauses = {gcnew CodeCatchClause,gcnew CodeCatchClause};
collection->AddRange( clauses );

// Adds a collection of CodeCatchClause objects to the collection.
CodeCatchClauseCollection^ clausesCollection = gcnew CodeCatchClauseCollection;
clausesCollection->Add( gcnew CodeCatchClause( "e",gcnew CodeTypeReference( System::ArgumentOutOfRangeException::typeid ) ) );
clausesCollection->Add( gcnew CodeCatchClause( "e" ) );
collection->AddRange( clausesCollection );
// Adds an array of CodeCatchClause objects to the collection.
CodeCatchClause[] clauses = { new CodeCatchClause(), new CodeCatchClause() };
collection.AddRange( clauses );

// Adds a collection of CodeCatchClause objects to the collection.
CodeCatchClauseCollection clausesCollection = new CodeCatchClauseCollection();
clausesCollection.Add( new CodeCatchClause("e", new CodeTypeReference(typeof(System.ArgumentOutOfRangeException))) );
clausesCollection.Add( new CodeCatchClause("e") );
collection.AddRange( clausesCollection );
' Adds an array of CodeCatchClause objects to the collection.
Dim clauses As CodeCatchClause() = {New CodeCatchClause(), New CodeCatchClause()}
collection.AddRange(clauses)

' Adds a collection of CodeCatchClause objects to the collection.
Dim clausesCollection As New CodeCatchClauseCollection()
clausesCollection.Add(New CodeCatchClause("e", New CodeTypeReference(GetType(System.ArgumentOutOfRangeException))))
clausesCollection.Add(New CodeCatchClause("e"))
collection.AddRange(clausesCollection)

另请参阅

适用于