CodeDirectiveCollection.Contains(CodeDirective) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定した CodeDirective オブジェクトがコレクションに含まれているかどうかを示す値を取得します。
public:
bool Contains(System::CodeDom::CodeDirective ^ value);
public bool Contains(System.CodeDom.CodeDirective value);
member this.Contains : System.CodeDom.CodeDirective -> bool
Public Function Contains (value As CodeDirective) As Boolean
パラメーター
- value
- CodeDirective
コレクション内で検索する CodeDirective オブジェクト。
返品
true コレクションに指定したオブジェクトが含まれている場合は 〗。それ以外の場合は false。
例
次のコード例は、 Contains メソッドを使用して、コレクションに特定の CodeDirective オブジェクトが含まれているかどうかを判断する方法を示しています。 この例は、 CodeDirectiveCollection クラスに提供されるより大きな例の一部です。
// Tests for the presence of a CodeDirective in the
// collection, and retrieves its index if it is found.
CodeDirective testDirective = new CodeRegionDirective(CodeRegionMode.Start, "Region1");
int itemIndex = -1;
if (collection.Contains(testDirective))
itemIndex = collection.IndexOf(testDirective);
' Tests for the presence of a CodeDirective in the
' collection, and retrieves its index if it is found.
Dim testDirective = New CodeRegionDirective(CodeRegionMode.Start, "Region1")
Dim itemIndex As Integer = -1
If collection.Contains(testDirective) Then
itemIndex = collection.IndexOf(testDirective)
End If