CodeCommentStatementCollection.Contains(CodeCommentStatement) Метод
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает значение, указывающее, содержит ли коллекция указанный 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