CompilerErrorCollection.Contains(CompilerError) Metod

Definition

Hämtar ett värde som anger om samlingen innehåller det angivna CompilerError objektet.

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

Parametrar

value
CompilerError

Att CompilerError hitta.

Returer

trueom finns CompilerError i samlingen, annars . false

Exempel

I följande exempel används Contains metoden för att hitta ett specifikt CompilerError objekt och fastställa indexvärdet som det hittades på.

// 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

Gäller för

Se även