CompilerErrorCollection.Contains(CompilerError) Método

Definição

Recebe um valor que indica se a coleção contém o objeto especificado CompilerError .

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

Parâmetros

value
CompilerError

O CompilerError para localizar.

Devoluções

true se o CompilerError estiver contido na coleção; caso contrário, false.

Exemplos

O exemplo seguinte utiliza o Contains método para localizar um objeto específico CompilerError e determinar o valor do índice em que foi encontrado.

// Tests for the presence of a CompilerError in the
// collection, and retrieves its index if it is found.
CompilerError testError = new CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text");
int itemIndex = -1;
if( collection.Contains( testError ) )
    itemIndex = collection.IndexOf( testError );
' Tests for the presence of a CompilerError in the 
' collection, and retrieves its index if it is found.
Dim testError As New CompilerError("Testfile.cs", 5, 10, "CS0001", "Example error text")
Dim itemIndex As Integer = -1
If collection.Contains(testError) Then
    itemIndex = collection.IndexOf(testError)
End If

Aplica-se a

Ver também