Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

CodeTypeDeclarationCollection.Contains Method

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

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