CacheExtensions.TryGetValue<TItem>(IMemoryCache, Object, TItem) Méthode

Définition

Tente d’obtenir la valeur associée à une clé spécifiée.

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

Paramètres de type

TItem

Type de l'objet à obtenir.

Paramètres

cache
IMemoryCache

La IMemoryCache instance cette méthode s’étend.

key
Object

Clé de la valeur à obtenir.

value
TItem

Valeur associée à la clé donnée.

Retours

true si la clé a été trouvée. Sinon, false.

S’applique à