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

适用于

另请参阅