CodeTypeDeclarationCollection.IndexOf(CodeTypeDeclaration) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
コレクション内に存在する場合は、CodeTypeDeclaration内の指定したCodeTypeDeclarationCollection オブジェクトのインデックスを取得します。
public:
int IndexOf(System::CodeDom::CodeTypeDeclaration ^ value);
public int IndexOf(System.CodeDom.CodeTypeDeclaration value);
member this.IndexOf : System.CodeDom.CodeTypeDeclaration -> int
Public Function IndexOf (value As CodeTypeDeclaration) As Integer
パラメーター
- 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 );
' Tests for the presence of a CodeTypeDeclaration in the
' collection, and retrieves its index if it is found.
Dim testDeclaration As New CodeTypeDeclaration("TestType")
Dim itemIndex As Integer = -1
If collection.Contains(testDeclaration) Then
itemIndex = collection.IndexOf(testDeclaration)
End If