編輯

共用方式為


CodeStatementCollection.Contains(CodeStatement) Method

Definition

Gets a value that indicates whether the collection contains the specified CodeStatement object.

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

Parameters

value
CodeStatement

The CodeStatement object to search for in the collection.

Returns

true if the collection contains the specified object; otherwise, false.

Examples

The following example uses the Contains method to search for the presence of a specific CodeStatement and retrieve the index value at which it was found.

// 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

Applies to

See also