IRegion TKey, TValue  Contains Method Pivotal GemFire .NET Client Documentation
Determines whether the ICollection contains a specific value.

Namespace: GemStone.GemFire.Cache.Generic
Assembly: GemStone.GemFire.Cache (in GemStone.GemFire.Cache.dll) Version:

bool Contains(
	KeyValuePair<TKey, TValue> keyValuePair


Type: System.Collections.Generic KeyValuePair TKey, TValue 
The KeyValuePair structure to locate in the ICollection.

Return Value

true if keyValuePair is found in the ICollection; otherwise, false.

[!:IllegalArgumentException] if key is null
[!:CacheLoaderException] if CacheLoader throws an exception
[!:CacheServerException] If an exception is received from the Java cache server. Only for Native Client regions.
[!:NotConnectedException] if not connected to the GemFire system because the client cannot establish usable connections to any of the servers given to it. For pools configured with locators, if no locators are available, innerException of NotConnectedException is set to NoAvailableLocatorsException.
[!:MessageException] If the message received from server could not be handled. This will be the case when an unregistered typeId is received in the reply or reply is not well formed. More information can be found in the log.
System TimeoutException if the operation timed out
[!:RegionDestroyedException] if this region has been destroyed

For local region instance - returns the value with the specified key from the local cache only. For distributed region instance - If the value is not present locally then it is requested from the java server. If even that is unsuccessful then a local CacheLoader will be invoked if there is one.

The comparison of the value of the key value pair depends on the Equals function of the TValue class. If the Equals function is not overriden in the TValue class the behavior of this function is undefined. Hence, this function won't work properly for the .NET types that uses the default implementation of the Equals method, for e.g. arrays.

See Also