Contains Method

[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]

Determines whether the Hashtable contains a specific key.

Namespace:  System.Collections
Assembly:  mscorlib (in mscorlib.dll)

public:
virtual bool Contains(
	Object^ key
) sealed

Parameters

key
Type: System..::..Object
The key to locate in the Hashtable.

Return Value

Type: System..::..Boolean
true if the Hashtable contains an element with the specified key; otherwise, false.

Implements

IDictionary..::..Contains(Object)

ExceptionCondition
ArgumentNullException

key is nullNothingnullptrunita null reference (Nothing in Visual Basic).

Contains implements IDictionary..::..Contains. It behaves exactly as ContainsKey.

This method is an O(1) operation.

Show: