Freigeben über


CompilerErrorCollection.IndexOf-Methode

Ruft den Index der angegebenen CompilerError-Klasse in der Auflistung ab, sofern diese in der Auflistung vorhanden ist.

Namespace: System.CodeDom.Compiler
Assembly: System (in system.dll)

Syntax

'Declaration
Public Function IndexOf ( _
    value As CompilerError _
) As Integer
'Usage
Dim instance As CompilerErrorCollection
Dim value As CompilerError
Dim returnValue As Integer

returnValue = instance.IndexOf(value)
public int IndexOf (
    CompilerError value
)
public:
int IndexOf (
    CompilerError^ value
)
public int IndexOf (
    CompilerError value
)
public function IndexOf (
    value : CompilerError
) : int

Parameter

Rückgabewert

Der Index der angegebenen CompilerError-Klasse in der CompilerErrorCollection-Klasse, sofern diese gefunden wird, andernfalls -1.

Beispiel

' 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
// 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.
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.JSL", 5, 10,
    "JSL0001", "Example error text");
int itemIndex = -1;
if (collection.Contains(testError)) {
    itemIndex = collection.IndexOf(testError);
}

Plattformen

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.

Versionsinformationen

.NET Framework

Unterstützt in: 2.0, 1.1, 1.0

Siehe auch

Referenz

CompilerErrorCollection-Klasse
CompilerErrorCollection-Member
System.CodeDom.Compiler-Namespace
Contains