Hello.
I was creating a Func as parameter input to another method, but how do I invoke that?
The following code describes my work:
I call Foo with:
Foo(x => x.SlidingExpiration(TimeSpan.FromSeconds(50)));
My method Foo:
public void Foo(Func<CacheExpiration, TimeSpan> cacheExpiration)
{
....
inside here I want to call RefreshCache, but how?.. cacheExpiration.??
}
The CacheExpiration :)
public class CacheExpiration
{
TimeSpan timeSpan;
bool sliding;
public TimeSpan SlidingExpiration(TimeSpan ts)
{
this.timeSpan = ts;
this.sliding = true;
return ts;
}
public TimeSpan AbsoluteExpiration(TimeSpan ts)
{
this.timeSpan = ts;
return ts;
}
public bool RefreshCache(MetaObject mo)
{
//some logic....
return true;
}
}