CodeTypeDeclarationCollection.Contains Method (CodeTypeDeclaration)

 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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

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

public bool Contains(
	CodeTypeDeclaration value
)

Parameters

value
Type: System.CodeDom.CodeTypeDeclaration

The CodeTypeDeclaration object to search for in the collection.

Return Value

Type: System.Boolean

true if the collection contains the specified object; otherwise, false.

The following example demonstrates how to use the Contains method to find a CodeTypeDeclaration object in a CodeTypeDeclarationCollection.

// Tests for the presence of a CodeTypeDeclaration in the 
// collection, and retrieves its index if it is found.
CodeTypeDeclaration testDeclaration = new CodeTypeDeclaration("TestType");
int itemIndex = -1;
if( collection.Contains( testDeclaration ) )
    itemIndex = collection.IndexOf( testDeclaration );

.NET Framework
Available since 1.1
Return to top
Show: