Share via


CodeCatchClauseCollection.AddRange 方法

定義

將指定的 CodeCatchClause 陣列元素複製到集合的末端。

多載

AddRange(CodeCatchClause[])

將指定的 CodeCatchClause 陣列元素複製到集合的末端。

AddRange(CodeCatchClauseCollection)

將另一個 CodeCatchClauseCollection 物件的內容複製到集合的結尾。

AddRange(CodeCatchClause[])

來源:
CodeCatchClauseCollection.cs
來源:
CodeCatchClauseCollection.cs
來源:
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)

來源:
CodeCatchClauseCollection.cs
來源:
CodeCatchClauseCollection.cs
來源:
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)

另請參閱

適用於