CodeTypeDeclarationCollection.Contains(CodeTypeDeclaration) Metod
Definition
Viktigt
En del information gäller för förhandsversionen av en produkt och kan komma att ändras avsevärt innan produkten blir allmänt tillgänglig. Microsoft lämnar inga garantier, uttryckliga eller underförstådda, avseende informationen som visas här.
Hämtar ett värde som anger om samlingen innehåller det angivna CodeTypeDeclaration objektet.
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
Parametrar
- value
- CodeTypeDeclaration
Objektet CodeTypeDeclaration som ska sökas efter i samlingen.
Returer
trueom samlingen innehåller det angivna objektet; annars . false
Exempel
I följande exempel visas hur du använder Contains metoden för att hitta ett CodeTypeDeclaration objekt i en CodeTypeDeclarationCollection.
// 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