CodeAttributeArgumentCollection.Contains(CodeAttributeArgument) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會獲得一個值,表示該集合是否包含指定的 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 方法搜尋特定 CodeAttributeArgument 物件在 a CodeAttributeArgumentCollection 中的存在,並取得該物件被發現的索引值。
// 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