CompilerErrorCollection.IndexOf(CompilerError) Método
Definição
Importante
Algumas informações dizem respeito a um produto pré-lançado que pode ser substancialmente modificado antes de ser lançado. A Microsoft não faz garantias, de forma expressa ou implícita, em relação à informação aqui apresentada.
Obtém o índice do objeto especificado CompilerError na coleção, se este existir na coleção.
public:
int IndexOf(System::CodeDom::Compiler::CompilerError ^ value);
public int IndexOf(System.CodeDom.Compiler.CompilerError value);
member this.IndexOf : System.CodeDom.Compiler.CompilerError -> int
Public Function IndexOf (value As CompilerError) As Integer
Parâmetros
- value
- CompilerError
O CompilerError para localizar.
Devoluções
O índice do especificado CompilerError no CompilerErrorCollection, se encontrado; caso contrário, -1.
Exemplos
O exemplo seguinte procura um objeto específico CompilerError e utiliza o IndexOf método para determinar o valor do índice a 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