Skip to content

Instantly share code, notes, and snippets.

View ShiroTeky's full-sized avatar

Hubert Tecleky ShiroTeky

View GitHub Profile
@ShiroTeky
ShiroTeky / Asynchronous lambda with Func
Last active October 21, 2017 08:02
I share this simple article to show you some code about a TCache async method. I encountered this exception: Unable to convert a async lambda expression in Func.
//lambda async expression in func
//the previows signature was :T Get(string cacheKeyName, int cacheTimeOutSeconds, Func<T> func)
string cacheName = "all-tenants-cache-name";
int cacheTimeOutSeconds = 30;
List<Tenant> tenants =
await new TCacheProvider<List<Tenant>>().Get(
cacheName, cacheTimeOutSeconds,
async () =>{
//here some asynchronous methods