CodeExpressionCollection.Contains(CodeExpression) 方法

定義

會獲得一個值,表示該集合是否包含指定的 CodeExpression 物件。

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

參數

value
CodeExpression

CodeExpression要在收藏中找到的物件。

傳回

true若集合包含指定的物件;否則,。 false

範例

以下範例使用該 Contains 方法搜尋特定 CodeExpression 物件的存在,並取得該物件所在的索引值。

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

適用於

另請參閱