CodeNamespaceCollection.IndexOf(CodeNamespace) メソッド

定義

コレクション内に存在する場合は、CodeNamespace内の指定したCodeNamespaceCollection オブジェクトのインデックスを取得します。

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

パラメーター

value
CodeNamespace

検索する CodeNamespace

返品

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

次の例では、特定の CodeNamespace の存在を検索し、 IndexOf メソッドを使用して、検出されたインデックス値を取得します。

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

適用対象

こちらもご覧ください