CodeParameterDeclarationExpressionCollection.IndexOf メソッド

定義

指定した CodeParameterDeclarationExpressionのコレクション内にインデックスが存在する場合は、そのインデックスを取得します。

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

パラメーター

value
CodeParameterDeclarationExpression

コレクション内で検索する CodeParameterDeclarationExpression

返品

指定したオブジェクトのコレクション内のインデックス (見つかった場合)。それ以外の場合は -1。

次の例では、特定の CodeParameterDeclarationExpression インスタンスの存在を検索し、 IndexOf メソッドを使用して、見つかったインデックス値を取得します。

// Tests for the presence of a CodeParameterDeclarationExpression
// in the collection, and retrieves its index if it is found.
CodeParameterDeclarationExpression testParameter = new CodeParameterDeclarationExpression(typeof(int), "testIntArgument");
int itemIndex = -1;
if( collection.Contains( testParameter ) )
    itemIndex = collection.IndexOf( testParameter );
' Tests for the presence of a CodeParameterDeclarationExpression 
' in the collection, and retrieves its index if it is found.
Dim testParameter As New CodeParameterDeclarationExpression(GetType(Integer), "testIntArgument")
Dim itemIndex As Integer = -1
If collection.Contains(testParameter) Then
    itemIndex = collection.IndexOf(testParameter)
End If

適用対象

こちらもご覧ください