PropertyCollection.IDictionary.Contains Method (Object)


Determines whether the IDictionary object contains an element with the specified key.

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

bool IDictionary.Contains(
	object value


Type: System.Object

The key to locate in the IDictionary object.

Return Value

Type: System.Boolean

true if the IDictionary contains an element with the key; otherwise, false.

Exception Condition

key is null.

The following example demonstrates how to implement the Contains method. This example is part of a larger example provided for the IDictionary class.

public bool Contains(object key)
   Int32 index;
   return TryGetIndexOfKey(key, out index);

.NET Framework
Available since 1.1
Return to top