This documentation is archived and is not being maintained.
MemoryCache::Item Property
Visual Studio 2010
Gets or sets a value in the cache by using the default indexer property for an instance of the MemoryCache class.
Assembly: System.Runtime.Caching (in System.Runtime.Caching.dll)
public: virtual property Object^ Item[String^ key] { Object^ get (String^ key) override; void set (String^ key, Object^ value) override; }
Parameters
- key
- Type: System::String
A unique identifier for the cache value to get or set.
Property Value
Type: System::ObjectThe value in the cache instance for the specified key, if the entry exists; otherwise, nullptr.
| Exception | Condition |
|---|---|
| ArgumentNullException | key is nullptr. -or- The inserted value is nullptr. |
When you set this property, the value is inserted into the cache. The expiration policy for the cache entry is set to InfiniteAbsoluteExpiration. If a cache entry with a matching key already exists, its value is updated.
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: