MemoryCache::Remove Method (String^, String^)

.NET Framework (current version)

Removes a cache entry from the cache.

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

virtual Object^ Remove(
	String^ key,
	String^ regionName = null
) override


Type: System::String^

A unique identifier for the cache entry to remove.

Type: System::String^

A named region in the cache to which a cache entry was added. Do not pass a value for this parameter. This parameter is null by default, because the MemoryCache class does not implement regions.

Return Value

Type: System::Object^

If the entry is found in the cache, the removed cache entry; otherwise, null.

Exception Condition

regionName is not null.


key is null.

If the entry specified by key exists in the cache, removing the item triggers any associated change monitors. If the removed item was associated with a CacheItemUpdateCallback object or a CacheItemRemovedCallback object, the reason passed to the callback is Removed.

.NET Framework
Available since 4.0
Return to top