CodeAttributeDeclarationCollection.IndexOf(CodeAttributeDeclaration) Methode
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee haalt u de index op van het opgegeven CodeAttributeDeclaration object in de verzameling, als het in de verzameling bestaat.
public:
int IndexOf(System::CodeDom::CodeAttributeDeclaration ^ value);
public int IndexOf(System.CodeDom.CodeAttributeDeclaration value);
member this.IndexOf : System.CodeDom.CodeAttributeDeclaration -> int
Public Function IndexOf (value As CodeAttributeDeclaration) As Integer
Parameters
- value
- CodeAttributeDeclaration
Het CodeAttributeDeclaration object dat in de verzameling moet worden gevonden.
Retouren
De index in de verzameling van het opgegeven object, indien gevonden; anders, -1.
Voorbeelden
In het volgende voorbeeld wordt gezocht naar de aanwezigheid van een specifiek CodeAttributeDeclaration exemplaar en wordt de IndexOf methode gebruikt om de indexwaarde op te halen waarop deze is gevonden.
// 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