Aracılığıyla paylaş


CodeTypeMemberCollection.IndexOf(CodeTypeMember) Yöntem

Tanım

Belirtilen CodeTypeMemberkoleksiyonundaki dizini, koleksiyonda varsa alır.

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

Parametreler

value
CodeTypeMember

CodeTypeMember Koleksiyonda bulunacak.

Döndürülenler

Bulunursa, belirtilen nesnenin koleksiyonundaki dizin; aksi takdirde, -1.

Örnekler

Aşağıdaki kod örneği, belirli CodeTypeMember bir nesnenin varlığını arar ve bulunduğu dizin değerini almak için yöntemini kullanır IndexOf .

// Tests for the presence of a CodeTypeMember in the collection, 
// and retrieves its index if it is found.
CodeTypeMember^ testMember = gcnew CodeMemberField( "System.String","TestStringField" );
int itemIndex = -1;
if ( collection->Contains( testMember ) )
   itemIndex = collection->IndexOf( testMember );
// Tests for the presence of a CodeTypeMember in the collection,
// and retrieves its index if it is found.
CodeTypeMember testMember = new CodeMemberField("System.String", "TestStringField");
int itemIndex = -1;
if( collection.Contains( testMember ) )
    itemIndex = collection.IndexOf( testMember );
' Tests for the presence of a CodeTypeMember within the collection, and retrieves its index if it is within the collection.
Dim testMember = New CodeMemberField("System.String", "TestStringField")
Dim itemIndex As Integer = -1
If collection.Contains(testMember) Then
    itemIndex = collection.IndexOf(testMember)
End If

Şunlara uygulanır

Ayrıca bkz.