CodeTypeDeclarationCollection.AddRange 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將指定的陣列元素複製到集合末端。
多載
AddRange(CodeTypeDeclaration[]) |
將指定的陣列元素複製到集合末端。 |
AddRange(CodeTypeDeclarationCollection) |
將另一個 CodeTypeDeclarationCollection 物件的內容加入至集合的結尾。 |
AddRange(CodeTypeDeclaration[])
將指定的陣列元素複製到集合末端。
public:
void AddRange(cli::array <System::CodeDom::CodeTypeDeclaration ^> ^ value);
public void AddRange (System.CodeDom.CodeTypeDeclaration[] value);
member this.AddRange : System.CodeDom.CodeTypeDeclaration[] -> unit
Public Sub AddRange (value As CodeTypeDeclaration())
參數
- value
- CodeTypeDeclaration[]
CodeTypeDeclaration 型別的陣列,包含要加入至集合的物件。
例外狀況
value
為 null
。
範例
下列範例示範如何使用 AddRange(CodeTypeDeclaration[]) 方法多載,將物件的陣列 CodeTypeDeclaration 新增至 CodeTypeDeclarationCollection。
// Adds an array of CodeTypeDeclaration objects to the collection.
array<CodeTypeDeclaration^>^declarations = {gcnew CodeTypeDeclaration( "TestType1" ),gcnew CodeTypeDeclaration( "TestType2" )};
collection->AddRange( declarations );
// Adds a collection of CodeTypeDeclaration objects to the
// collection.
CodeTypeDeclarationCollection^ declarationsCollection = gcnew CodeTypeDeclarationCollection;
declarationsCollection->Add( gcnew CodeTypeDeclaration( "TestType1" ) );
declarationsCollection->Add( gcnew CodeTypeDeclaration( "TestType2" ) );
collection->AddRange( declarationsCollection );
// Adds an array of CodeTypeDeclaration objects to the collection.
CodeTypeDeclaration[] declarations = { new CodeTypeDeclaration("TestType1"), new CodeTypeDeclaration("TestType2") };
collection.AddRange( declarations );
// Adds a collection of CodeTypeDeclaration objects to the
// collection.
CodeTypeDeclarationCollection declarationsCollection = new CodeTypeDeclarationCollection();
declarationsCollection.Add( new CodeTypeDeclaration("TestType1") );
declarationsCollection.Add( new CodeTypeDeclaration("TestType2") );
collection.AddRange( declarationsCollection );
' Adds an array of CodeTypeDeclaration objects to the
' collection.
Dim declarations As CodeTypeDeclaration() = {New CodeTypeDeclaration("TestType1"), New CodeTypeDeclaration("TestType2")}
collection.AddRange(declarations)
' Adds a collection of CodeTypeDeclaration objects to the collection.
Dim declarationsCollection As New CodeTypeDeclarationCollection()
declarationsCollection.Add(New CodeTypeDeclaration("TestType1"))
declarationsCollection.Add(New CodeTypeDeclaration("TestType2"))
collection.AddRange(declarationsCollection)
另請參閱
適用於
AddRange(CodeTypeDeclarationCollection)
將另一個 CodeTypeDeclarationCollection 物件的內容加入至集合的結尾。
public:
void AddRange(System::CodeDom::CodeTypeDeclarationCollection ^ value);
public void AddRange (System.CodeDom.CodeTypeDeclarationCollection value);
member this.AddRange : System.CodeDom.CodeTypeDeclarationCollection -> unit
Public Sub AddRange (value As CodeTypeDeclarationCollection)
參數
CodeTypeDeclarationCollection 物件,包含要加入至集合的物件。
例外狀況
value
為 null
。
範例
下列範例示範如何使用 AddRange(CodeTypeDeclarationCollection) 方法多載,將物件從一個新增 CodeTypeDeclaration 到另一個 CodeTypeDeclarationCollectionCodeTypeDeclarationCollection。
// Adds an array of CodeTypeDeclaration objects to the collection.
array<CodeTypeDeclaration^>^declarations = {gcnew CodeTypeDeclaration( "TestType1" ),gcnew CodeTypeDeclaration( "TestType2" )};
collection->AddRange( declarations );
// Adds a collection of CodeTypeDeclaration objects to the
// collection.
CodeTypeDeclarationCollection^ declarationsCollection = gcnew CodeTypeDeclarationCollection;
declarationsCollection->Add( gcnew CodeTypeDeclaration( "TestType1" ) );
declarationsCollection->Add( gcnew CodeTypeDeclaration( "TestType2" ) );
collection->AddRange( declarationsCollection );
// Adds an array of CodeTypeDeclaration objects to the collection.
CodeTypeDeclaration[] declarations = { new CodeTypeDeclaration("TestType1"), new CodeTypeDeclaration("TestType2") };
collection.AddRange( declarations );
// Adds a collection of CodeTypeDeclaration objects to the
// collection.
CodeTypeDeclarationCollection declarationsCollection = new CodeTypeDeclarationCollection();
declarationsCollection.Add( new CodeTypeDeclaration("TestType1") );
declarationsCollection.Add( new CodeTypeDeclaration("TestType2") );
collection.AddRange( declarationsCollection );
' Adds an array of CodeTypeDeclaration objects to the
' collection.
Dim declarations As CodeTypeDeclaration() = {New CodeTypeDeclaration("TestType1"), New CodeTypeDeclaration("TestType2")}
collection.AddRange(declarations)
' Adds a collection of CodeTypeDeclaration objects to the collection.
Dim declarationsCollection As New CodeTypeDeclarationCollection()
declarationsCollection.Add(New CodeTypeDeclaration("TestType1"))
declarationsCollection.Add(New CodeTypeDeclaration("TestType2"))
collection.AddRange(declarationsCollection)