CompilerErrorCollection.Contains(CompilerError) Methode

Definition

Ruft einen Wert ab, der angibt, ob die Auflistung das angegebene CompilerError-Objekt enthält.

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

Parameter

value
CompilerError

Die zu suchende CompilerError.

Gibt zurück

true, wenn CompilerError in der Auflistung enthalten ist, andernfalls false.

Beispiele

Im folgenden Beispiel wird die Contains -Methode verwendet, um ein bestimmtes CompilerError Objekt zu suchen und den Indexwert zu bestimmen, an dem es gefunden wurde.

// Tests for the presence of a CompilerError in the
// collection, and retrieves its index if it is found.
CompilerError^ testError = gcnew 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.
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

Gilt für:

Weitere Informationen