CodeTypeDeclarationCollection.IndexOf(CodeTypeDeclaration) CodeTypeDeclarationCollection.IndexOf(CodeTypeDeclaration) CodeTypeDeclarationCollection.IndexOf(CodeTypeDeclaration) CodeTypeDeclarationCollection.IndexOf(CodeTypeDeclaration) Method

Определение

Получает значение указанного объекта CodeTypeDeclaration в CodeTypeDeclarationCollection, если он существует в коллекции.Gets the index of the specified CodeTypeDeclaration object in the CodeTypeDeclarationCollection, if it exists in the collection.

public:
 int IndexOf(System::CodeDom::CodeTypeDeclaration ^ value);
public int IndexOf (System.CodeDom.CodeTypeDeclaration value);
member this.IndexOf : System.CodeDom.CodeTypeDeclaration -> int
Public Function IndexOf (value As CodeTypeDeclaration) As Integer

Параметры

value
CodeTypeDeclaration CodeTypeDeclaration CodeTypeDeclaration CodeTypeDeclaration

Объект CodeTypeDeclaration для поиска в коллекции.The CodeTypeDeclaration to locate in the collection.

Возвраты

Индекс указанного объекта, если найден в коллекции; в противном случае — значение -1.The index of the specified object, if it is found, in the collection; otherwise, -1.

Примеры

В следующем примере извлекаются CodeTypeDeclaration записи CodeTypeDeclarationCollection из объекта и отображаются их имена IndexOf и индексы, возвращаемые методом.The following example retrieves CodeTypeDeclaration entries from a CodeTypeDeclarationCollection object and displays their names and indexes returned by the IndexOf method.

// 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

Применяется к

Дополнительно