CodeStatementCollection.Contains(CodeStatement) Метод

Определение

Получает значение, которое указывает, содержит ли коллекция заданный объект CodeStatement.

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

Параметры

value
CodeStatement

Объект CodeStatement для поиска в коллекции.

Возвращаемое значение

Значение true, если коллекция содержит указанный объект; в обратном случае — значение false.

Примеры

В следующем примере метод используется Contains для поиска наличия определенного CodeStatement объекта и получения значения индекса, в котором он был найден.

// Tests for the presence of a CodeStatement in the 
// collection, and retrieves its index if it is found.
int itemIndex = -1;
if ( collection->Contains( testStatement ) )
   itemIndex = collection->IndexOf( testStatement );
// Tests for the presence of a CodeStatement in the
// collection, and retrieves its index if it is found.
int itemIndex = -1;
if( collection.Contains( testStatement ) )
    itemIndex = collection.IndexOf( testStatement );
' Tests for the presence of a CodeStatement in the 
' collection, and retrieves its index if it is found.
Dim itemIndex As Integer = -1
If collection.Contains(testStatement) Then
    itemIndex = collection.IndexOf(testStatement)
End If

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

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