CodeAttributeArgumentCollection.Contains(CodeAttributeArgument) メソッド

定義

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

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

パラメーター

value
CodeAttributeArgument

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

返品

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

次の例では、Contains メソッドを使用して、CodeAttributeArgumentCollection内の特定のCodeAttributeArgument オブジェクトの存在を検索し、検出されたインデックス値を取得します。

// Tests for the presence of a CodeAttributeArgument
// within the collection, and retrieves its index if it is found.
CodeAttributeArgument testArgument = new CodeAttributeArgument("Test Boolean Argument", new CodePrimitiveExpression(true));
int itemIndex = -1;
if( collection.Contains( testArgument ) )
    itemIndex = collection.IndexOf( testArgument );
' Tests for the presence of a CodeAttributeArgument in 
' the collection, and retrieves its index if it is found.
Dim testArgument As New CodeAttributeArgument("Test Boolean Argument", New CodePrimitiveExpression(True))
Dim itemIndex As Integer = -1
If collection.Contains(testArgument) Then
    itemIndex = collection.IndexOf(testArgument)
End If

適用対象