Compartilhar via


CodeTypeMemberCollection.Contains(CodeTypeMember) Método

Definição

Obtém um valor que indica se a coleção contém o CodeTypeMember especificado.

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

Parâmetros

value
CodeTypeMember

O CodeTypeMember a ser pesquisado na coleção.

Retornos

true se a coleção contiver o objeto especificado; caso contrário, false.

Exemplos

O exemplo de código a seguir usa o Contains método para pesquisar a presença de um objeto específico CodeTypeMember e recuperar o valor de índice no qual ele foi encontrado.

// Tests for the presence of a CodeTypeMember in the collection, 
// and retrieves its index if it is found.
CodeTypeMember^ testMember = gcnew CodeMemberField( "System.String","TestStringField" );
int itemIndex = -1;
if ( collection->Contains( testMember ) )
   itemIndex = collection->IndexOf( testMember );
// Tests for the presence of a CodeTypeMember in the collection,
// and retrieves its index if it is found.
CodeTypeMember testMember = new CodeMemberField("System.String", "TestStringField");
int itemIndex = -1;
if( collection.Contains( testMember ) )
    itemIndex = collection.IndexOf( testMember );
' Tests for the presence of a CodeTypeMember within the collection, and retrieves its index if it is within the collection.
Dim testMember = New CodeMemberField("System.String", "TestStringField")
Dim itemIndex As Integer = -1
If collection.Contains(testMember) Then
    itemIndex = collection.IndexOf(testMember)
End If

Aplica-se a

Confira também