CodeAttributeDeclarationCollection.IndexOf(CodeAttributeDeclaration) Metódus
Definíció
Fontos
Egyes információk olyan, kiadás előtti termékekre vonatkoznak, amelyek a kiadásig még jelentősen módosulhatnak. A Microsoft nem vállal kifejezett vagy törvényi garanciát az itt megjelenő információért.
Lekéri a gyűjteményben megadott CodeAttributeDeclaration objektum indexét, ha az a gyűjteményben található.
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
Paraméterek
- value
- CodeAttributeDeclaration
A CodeAttributeDeclaration gyűjteményben keresendő objektum.
Válaszok
A megadott objektum gyűjteményében lévő index, ha megtalálható; ellenkező esetben -1.
Példák
Az alábbi példa egy adott CodeAttributeDeclaration példány jelenlétét keresi, és a IndexOf metódussal lekéri azt az indexértéket, amelynél a példány megtalálható.
// 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