MemoryCache.Contains Method

Determines whether a cache entry exists in the cache.

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

public override bool Contains(
	string key,
	string regionName
)

Parameters

key
Type: System.String

A unique identifier for the cache entry to search for.

regionName
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.Boolean
true if the cache contains a cache entry whose key matches key; otherwise, false.

ExceptionCondition
ArgumentNullException

key is null.

NotSupportedException

regionName is not null.

.NET Framework

Supported in: 4.6, 4.5, 4
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft