CacheExtensions.TryGetValue<TItem>(IMemoryCache, Object, TItem) Metodo

Definizione

Prova a ottenere il valore associato a una chiave specificata.

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

Parametri di tipo

TItem

Tipo dell'oggetto da ottenere.

Parametri

cache
IMemoryCache

L'istanza di IMemoryCache questo metodo si estende.

key
Object

Chiave del valore da ottenere.

value
TItem

Valore associato alla chiave specificata.

Restituisce

true se la chiave è stata trovata. In caso contrario, false.

Si applica a