Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

CacheExtensions.Get Method

Definition

Namespace:
Microsoft.Extensions.Caching.Memory
Assembly:
Microsoft.Extensions.Caching.Abstractions.dll
Package:
Microsoft.Extensions.Caching.Abstractions v11.0.0-preview.5.26302.115

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

Overloads

Name Description
Get(IMemoryCache, Object)

Gets the value associated with this key if present.

Get<TItem>(IMemoryCache, Object)

Gets the value associated with this key if present.

Get(IMemoryCache, Object)

Source:
MemoryCacheExtensions.cs
Source:
MemoryCacheExtensions.cs
Source:
MemoryCacheExtensions.cs
Source:
MemoryCacheExtensions.cs

Gets the value associated with this key if present.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Object ^ Get(Microsoft::Extensions::Caching::Memory::IMemoryCache ^ cache, System::Object ^ key);
public static object? Get(this Microsoft.Extensions.Caching.Memory.IMemoryCache cache, object key);
static member Get : Microsoft.Extensions.Caching.Memory.IMemoryCache * obj -> obj
<Extension()>
Public Function Get (cache As IMemoryCache, key As Object) As Object

Parameters

cache
IMemoryCache

The IMemoryCache instance this method extends.

key
Object

The key of the value to get.

Returns

The value associated with this key, or null if the key is not present.

Applies to

Get<TItem>(IMemoryCache, Object)

Source:
MemoryCacheExtensions.cs
Source:
MemoryCacheExtensions.cs
Source:
MemoryCacheExtensions.cs
Source:
MemoryCacheExtensions.cs

Gets the value associated with this key if present.

public:
generic <typename TItem>
[System::Runtime::CompilerServices::Extension]
 static TItem Get(Microsoft::Extensions::Caching::Memory::IMemoryCache ^ cache, System::Object ^ key);
public static TItem? Get<TItem>(this Microsoft.Extensions.Caching.Memory.IMemoryCache cache, object key);
static member Get : Microsoft.Extensions.Caching.Memory.IMemoryCache * obj -> 'Item
<Extension()>
Public Function Get(Of TItem) (cache As IMemoryCache, key As Object) As TItem

Type Parameters

TItem

The type of the object to get.

Parameters

cache
IMemoryCache

The IMemoryCache instance this method extends.

key
Object

The key of the value to get.

Returns

TItem

The value associated with this key, or default(TItem) if the key is not present.

Applies to


Feedback

Was this page helpful?