CodeTypeDeclarationCollection.Contains(CodeTypeDeclaration) メソッド

定義

指定した CodeTypeDeclaration オブジェクトがコレクションに含まれているかどうかを示す値を取得します。

public:
 bool Contains(System::CodeDom::CodeTypeDeclaration ^ value);
public bool Contains (System.CodeDom.CodeTypeDeclaration value);
member this.Contains : System.CodeDom.CodeTypeDeclaration -> bool
Public Function Contains (value As CodeTypeDeclaration) As Boolean

パラメーター

value
CodeTypeDeclaration

このコレクション内で検索する CodeTypeDeclaration オブジェクト。

戻り値

コレクションに指定したオブジェクトが格納されている場合は true。それ以外の場合は false

次の例では、 メソッドを使用 Contains して 内の オブジェクトを検索する CodeTypeDeclaration 方法を CodeTypeDeclarationCollection示します。

// Tests for the presence of a CodeTypeDeclaration in the 
// collection, and retrieves its index if it is found.
CodeTypeDeclaration^ testDeclaration = gcnew 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.
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

適用対象

こちらもご覧ください