CodeTypeDeclarationCollection.Contains(CodeTypeDeclaration) Metodo

Definizione

Ottiene un valore che indica se l'insieme contiene l'oggetto CodeTypeDeclaration specificato.

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

Parametri

value
CodeTypeDeclaration

L'oggetto CodeTypeDeclaration da cercare nell'insieme.

Restituisce

true se l'insieme contiene l'oggetto specificato; in caso contrario, false.

Esempio

Nell'esempio seguente viene illustrato come usare il Contains metodo per trovare un CodeTypeDeclaration oggetto in un CodeTypeDeclarationCollectionoggetto .

// Tests for the presence of a CodeTypeDeclaration in the 
// collection, and retrieves its index if it is found.
CodeTypeDeclaration^ testDeclaration = gcnew CodeTypeDeclaration( "TestType" );
int itemIndex = -1;
if ( collection->Contains( testDeclaration ) )
   itemIndex = collection->IndexOf( testDeclaration );
// Tests for the presence of a CodeTypeDeclaration in the
// collection, and retrieves its index if it is found.
CodeTypeDeclaration testDeclaration = new CodeTypeDeclaration("TestType");
int itemIndex = -1;
if( collection.Contains( testDeclaration ) )
    itemIndex = collection.IndexOf( testDeclaration );
' Tests for the presence of a CodeTypeDeclaration in the 
' collection, and retrieves its index if it is found.
Dim testDeclaration As New CodeTypeDeclaration("TestType")
Dim itemIndex As Integer = -1
If collection.Contains(testDeclaration) Then
    itemIndex = collection.IndexOf(testDeclaration)
End If

Si applica a

Vedi anche