共用方式為


CodeAttributeDeclarationCollection.Insert 方法

定義

將指定的 CodeAttributeDeclaration 物件插入至集合中所指定索引處。

public:
 void Insert(int index, System::CodeDom::CodeAttributeDeclaration ^ value);
public void Insert (int index, System.CodeDom.CodeAttributeDeclaration value);
member this.Insert : int * System.CodeDom.CodeAttributeDeclaration -> unit
Public Sub Insert (index As Integer, value As CodeAttributeDeclaration)

參數

index
Int32

以零起始的索引,是應將指定物件插入的位置。

value
CodeAttributeDeclaration

要插入的 CodeAttributeDeclaration 物件。

範例

下列範例示範如何使用 Insert 方法將 物件新增 CodeAttributeDeclarationCodeAttributeDeclarationCollection

// Inserts a CodeAttributeDeclaration at index 0 of the collection.
array<CodeAttributeArgument^>^temp4 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
collection->Insert( 0, gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp4 ) );
// Inserts a CodeAttributeDeclaration at index 0 of the collection.
collection.Insert( 0, new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description"))) );
' Inserts a CodeAttributeDeclaration at index 0 of the collection.
collection.Insert(0, New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description"))))

適用於

另請參閱