MemoryCache.Item Property (String)

.NET Framework (current version)
 
System_CAPS_noteNote

The .NET API Reference documentation has a new home. Visit the .NET API Browser on docs.microsoft.com to see the new experience.

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; }

Parameters

key
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.

Exception Condition
ArgumentNullException

key is null.

-or-

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
Available since 4.0
Return to top
Show: