Export (0) Print
Expand All

CompilerErrorCollection.Contains Method

Gets a value that indicates whether the collection contains the specified CompilerError object.

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

public bool Contains(
	CompilerError value
)

Parameters

value
Type: System.CodeDom.Compiler.CompilerError

The CompilerError to locate.

Return Value

Type: System.Boolean
true if the CompilerError is contained in the collection; otherwise, false.

The following example uses the Contains method to locate a specific CompilerError object and determine the index value at which it was found.

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

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft