There is the code:
Private Sub InsertItemInCache(Of T)(ByVal item As CachedItem(Of T), ByVal dependency As AggregateCacheDependency, _
ByVal key As String, ByVal updateCallBack As CacheItemUpdateCallback)
The CacheItemUpdateCallback signature is:
Sub CacheItemUpdateCallback(ByVal key As String, ByVal reason As CacheItemUpdateReason, _
ByRef expensiveObject As Object, ByRef dependency As CacheDependency, ByRef absoluteExpiration As Date, _
ByRef slidingExpiration As TimeSpan)
I want to call InsertItemInCache function using lamba expression for this. This code is not compiled:
InsertItemInCache(cachedItem, dependency, key, Function(k, r, e, d, a, s) CacheItemUpdateCallback(k, r, e, d, a, s))
it says Expression does not produce a value
If I change Sub CacheItemUpdateCallback to Function CacheItemUpdateCallback it also is not compiled and says Nested function does not have the same signature as delegate 'Delegate Sub CacheItemUpdateCallback(key As String, reason As System.Web.Caching.CacheItemUpdateReason, ByRef expensiveObject As Object, ByRef dependency As System.Web.Caching.CacheDependency, ByRef absoluteExpiration As Date, ByRef slidingExpiration As System.TimeSpan)'
Can anyone help me to call this method via lambda expression? I want to use closure in the future and call this function in such way:
InsertItemInCache(cachedItem, dependency, key, Function(k, r, e, d, a, s) CacheItemUpdateCallbackNew(k, r, e, d, a, s, additionalParameter1, additionalParameter2, additionalParameter3))