dotnet/AspNetCore.Docs

How to Get/Set A Type Not byte[]

开放

#16,031 创建于 2019年12月4日

 (8 条评论) (0 个反应) (0 位负责人)C# (24,791 个派生)batch import
Help wantedcode help wanteddoc-enhancement

仓库指标

星标
 (13,093 个星标)
PR 合并指标
 (平均合并 2天 17小时) (30 天内合并 49 个 PR)

描述

Is your feature request related to a problem? Please describe.

I Need Get/Set A Type Not byte[]

Describe the solution you'd like

private readonly IDistributedCache<Person> _genricCache;
private readonly IDistributedCache _cache;
public async Task Test()
{
    Person person = await _genricCache.GetAsync(key);
    //Or
    Person person = await _cache.GetAsync<Person>(key);
}

@Rick-Anderson edit: Integrated issue


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

贡献者指南