英語で読む

次の方法で共有


CodeTypeDeclarationCollection.IndexOf(CodeTypeDeclaration) メソッド

定義

指定された CodeTypeDeclaration オブジェクトが CodeTypeDeclarationCollection コレクション内に存在する場合は、コレクション内でのそのインデックスを取得します。

public int IndexOf (System.CodeDom.CodeTypeDeclaration value);

パラメーター

value
CodeTypeDeclaration

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

戻り値

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

次の例では、 CodeTypeDeclaration オブジェクトからエントリを CodeTypeDeclarationCollection 取得し、 メソッドによって返される名前とインデックスを IndexOf 表示します。

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

適用対象

こちらもご覧ください