MemoryCache.Item Property

Gets or sets a value in the cache by using the default indexer property for an instance of the MemoryCache class.

Namespace:  System.Runtime.Caching
Assembly:  System.Runtime.Caching (in System.Runtime.Caching.dll)

public override Object this[
	string key
] { get; set; }


Type: System.String

A unique identifier for the cache value to get or set.

Property Value

Type: System.Object
The value in the cache instance for the specified key, if the entry exists; otherwise, null.


key is null.


The inserted value is null.

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.

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
© 2014 Microsoft