CodeAttributeDeclarationCollection.Contains(CodeAttributeDeclaration) Metodo

Definizione

Ottiene o imposta un valore che indica se l'insieme contiene l'oggetto CodeAttributeDeclaration specificato.Gets or sets a value that indicates whether the collection contains the specified CodeAttributeDeclaration object.

public:
 bool Contains(System::CodeDom::CodeAttributeDeclaration ^ value);
public bool Contains (System.CodeDom.CodeAttributeDeclaration value);
member this.Contains : System.CodeDom.CodeAttributeDeclaration -> bool
Public Function Contains (value As CodeAttributeDeclaration) As Boolean

Parametri

value
CodeAttributeDeclaration

Oggetto CodeAttributeDeclaration da individuare.The CodeAttributeDeclaration object to locate.

Restituisce

true se l'insieme contiene l'oggetto specificato; in caso contrario, false.true if the collection contains the specified object; otherwise, false.

Esempi

Nell'esempio seguente viene utilizzato il metodo Contains per cercare la presenza di un'istanza di CodeAttributeDeclaration specifica e ottiene il valore di indice in corrispondenza del quale è stato trovato.The following example uses the Contains method to search for the presence of a specific CodeAttributeDeclaration instance and gets the index value at which it was found.

// Tests for the presence of a CodeAttributeDeclaration in 
// the collection, and retrieves its index if it is found.
array<CodeAttributeArgument^>^temp3 = {gcnew CodeAttributeArgument( gcnew CodePrimitiveExpression( "Test Description" ) )};
CodeAttributeDeclaration^ testdeclaration = gcnew CodeAttributeDeclaration( "DescriptionAttribute",temp3 );
int itemIndex = -1;
if ( collection->Contains( testdeclaration ) )
   itemIndex = collection->IndexOf( testdeclaration );
// Tests for the presence of a CodeAttributeDeclaration in 
// the collection, and retrieves its index if it is found.
CodeAttributeDeclaration testdeclaration = new CodeAttributeDeclaration("DescriptionAttribute", new CodeAttributeArgument(new CodePrimitiveExpression("Test Description")) );
int itemIndex = -1;
if( collection.Contains( testdeclaration ) )
    itemIndex = collection.IndexOf( testdeclaration );
' Tests for the presence of a CodeAttributeDeclaration in the 
' collection, and retrieves its index if it is found.
Dim testdeclaration As New CodeAttributeDeclaration("DescriptionAttribute", New CodeAttributeArgument(New CodePrimitiveExpression("Test Description")))
Dim itemIndex As Integer = -1
If collection.Contains(testdeclaration) Then
    itemIndex = collection.IndexOf(testdeclaration)
End If

Si applica a

Vedi anche