Bagikan melalui


CodeAttributeDeclarationCollection.Add(CodeAttributeDeclaration) Metode

Definisi

CodeAttributeDeclaration Menambahkan objek dengan nilai yang ditentukan ke koleksi.

public:
 int Add(System::CodeDom::CodeAttributeDeclaration ^ value);
public int Add (System.CodeDom.CodeAttributeDeclaration value);
member this.Add : System.CodeDom.CodeAttributeDeclaration -> int
Public Function Add (value As CodeAttributeDeclaration) As Integer

Parameter

value
CodeAttributeDeclaration

Objek CodeAttributeDeclaration yang akan ditambahkan.

Mengembalikan

Indeks tempat elemen baru disisipkan.

Contoh

Contoh berikut menunjukkan cara menambahkan CodeAttributeDeclaration objek ke CodeAttributeDeclarationCollection instans.

// Adds a CodeAttributeDeclaration to the collection.
array<CodeAttributeArgument^>^temp = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
collection->Add( gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp ) );
// Adds a CodeAttributeDeclaration to the collection.
collection.Add( new CodeAttributeDeclaration("DescriptionAttribute",  new CodeAttributeArgument(new CodePrimitiveExpression("Test Description"))) );
' Adds a CodeAttributeDeclaration to the collection.
collection.Add(New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description"))))

Berlaku untuk

Lihat juga