CodeCommentStatementCollection.Contains(CodeCommentStatement) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
會獲得一個值,表示該集合是否包含指定的 CodeCommentStatement 物件。
public:
bool Contains(System::CodeDom::CodeCommentStatement ^ value);
public bool Contains(System.CodeDom.CodeCommentStatement value);
member this.Contains : System.CodeDom.CodeCommentStatement -> bool
Public Function Contains (value As CodeCommentStatement) As Boolean
參數
- value
- CodeCommentStatement
在收藏中搜尋。CodeCommentStatement
傳回
true若集合包含指定的物件;否則,。 false
範例
以下範例使用該 Contains 方法搜尋特定 CodeCommentStatement 物件的存在,並取得該物件所在的索引值。
// Tests for the presence of a CodeCommentStatement in the
// collection, and retrieves its index if it is found.
CodeCommentStatement testComment = new CodeCommentStatement("Test comment");
int itemIndex = -1;
if( collection.Contains( testComment ) )
itemIndex = collection.IndexOf( testComment );
' Tests for the presence of a CodeCommentStatement in the
' collection, and retrieves its index if it is found.
Dim testComment As New CodeCommentStatement("Test comment")
Dim itemIndex As Integer = -1
If collection.Contains(testComment) Then
itemIndex = collection.IndexOf(testComment)
End If