CodeStatementCollection.IndexOf(CodeStatement) Yöntem

Tanım

Koleksiyonda CodeStatementvarsa içinde belirtilen CodeStatementCollection nesnenin dizinini alır.

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

Parametreler

value
CodeStatement

CodeStatement koleksiyonda bulmak için.

Döndürülenler

Belirtilen nesnenin dizini bulunursa koleksiyonda; aksi takdirde, -1.

Örnekler

Aşağıdaki örnek belirli CodeStatement bir varlığı arar ve bulunduğu dizin değerini almak için yöntemini kullanır IndexOf .

// Tests for the presence of a CodeStatement in the
// collection, and retrieves its index if it is found.
int itemIndex = -1;
if( collection.Contains( testStatement ) )
    itemIndex = collection.IndexOf( testStatement );
' Tests for the presence of a CodeStatement in the 
' collection, and retrieves its index if it is found.
Dim itemIndex As Integer = -1
If collection.Contains(testStatement) Then
    itemIndex = collection.IndexOf(testStatement)
End If

Şunlara uygulanır

Ayrıca bkz.