CodeAttributeDeclarationCollection.Contains(CodeAttributeDeclaration) 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 eller anger ett värde som anger om samlingen innehåller det angivna CodeAttributeDeclaration objektet.
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
Parametrar
- value
- CodeAttributeDeclaration
Objektet CodeAttributeDeclaration som ska hittas.
Returer
trueom samlingen innehåller det angivna objektet; annars . false
Exempel
I följande exempel används Contains metoden för att söka efter förekomsten av en specifik CodeAttributeDeclaration instans och hämtar indexvärdet där den hittades.
// 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