IRegion TKey, TValue  Item Property (TKey)Pivotal GemFire .NET Client Documentation
Gets or sets the element with the specified key.

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

TValue this[
	TKey key
] { get; set; }

Parameters

key
Type: TKey
The key of the element to get or set.

Implements

IDictionary TKey, TValue  Item TKey 
Exceptions

ExceptionCondition
[!:IllegalArgumentException] if key is null
System.Collections.Generic KeyNotFoundException If given key was not present in the region and if region is not in secure mode, or if Pool attached with Region is not in multiusersecure mode.
[!:EntryNotFoundException] if given key's value is null.
[!:CacheWriterException] if CacheWriter aborts the operation
[!:CacheListenerException] if CacheListener throws an exception
[!:RegionDestroyedException] if region has been destroyed
[!: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.
System TimeoutException if the operation timed out
System OutOfMemoryException if there is not enough memory for the value
[!:CacheLoaderException] if CacheLoader throws an exception
[!: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.
Remarks

This property provides the ability to access a specific element in the collection by using the following syntax: myCollection[key]. You can also use the Item property to add new elements by setting the value of a key that does not exist in the dictionary; for example, myCollection["myNonexistentKey"] = myValue However, if the specified key already exists in the dictionary, setting the Item property overwrites the old value. In contrast, the Add method does not modify existing elements. This property is applicable to local as well as distributed region. For local region instance - Puts/Gets a new value into an entry in this region in the local cache only. For distributed region instance - Puts/Gets a new value into an entry in this region and this operation is propogated to the Gemfire cache server to which it is connected with.
See Also