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 = gcnew 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.
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

Применяется к

См. также раздел