CacheExtensions.TryGetValue<TItem>(IMemoryCache, Object, TItem) 方法

定義

嘗試取得與指定索引鍵相關聯的值。

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

類型參數

TItem

要取得的物件類型。

參數

cache
IMemoryCache

IMemoryCache這個方法擴充的實例。

key
Object

要取得之值的索引鍵。

value
TItem

與指定索引鍵相關聯的值。

傳回

如果找到索引鍵,則為 true。 否則為 false

適用於