Lookup<TKey, TElement>.Contains Method

Determines whether a specified key is in the Lookup<TKey, TElement>.

Namespace:  System.Linq
Assembly:  System.Core (in System.Core.dll)

public bool Contains(
	TKey key


Type: TKey
The key to find in the Lookup<TKey, TElement>.

Return Value

Type: System.Boolean
true if key is in the Lookup<TKey, TElement>; otherwise, false.


ILookup<TKey, TElement>.Contains(TKey)

The following example demonstrates how to use Contains to determine whether a Lookup<TKey, TElement> contains a specified key. This code example is part of a larger example provided for the Lookup<TKey, TElement> class.

// Determine if there is a key with the value 'G' in the Lookup.
bool hasG = lookup.Contains('G');


Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions