CodeExpressionCollection.IndexOf(CodeExpression) Yöntem

Tanım

Koleksiyonda varsa, koleksiyonda belirtilen CodeExpression nesnenin dizinini alır.

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

Parametreler

value
CodeExpression

CodeExpression Koleksiyonda bulunacak nesne.

Döndürülenler

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

Örnekler

Aşağıdaki örnek, belirli CodeExpression 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 CodeExpression in the 
// collection, and retrieves its index if it is found.
CodeExpression^ testComment = gcnew CodePrimitiveExpression( true );
int itemIndex = -1;
if ( collection->Contains( testComment ) )
   itemIndex = collection->IndexOf( testComment );
// Tests for the presence of a CodeExpression in the
// collection, and retrieves its index if it is found.
CodeExpression testComment = new CodePrimitiveExpression(true);
int itemIndex = -1;
if( collection.Contains( testComment ) )
    itemIndex = collection.IndexOf( testComment );
' Tests for the presence of a CodeExpression in the 
' collection, and retrieves its index if it is found.
Dim testComment = New CodePrimitiveExpression(True)
Dim itemIndex As Integer = -1
If collection.Contains(testComment) Then
    itemIndex = collection.IndexOf(testComment)
End If

Şunlara uygulanır

Ayrıca bkz.