VB lambda expression for sub delegate

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Egor Moroz
    New Member
    • Nov 2010
    • 1

    VB lambda expression for sub delegate

    There is the code:

    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 signature of CacheItemUpdate Callback is:

    Code:
    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 InsertItemInCac he function using lamba expression for this.
    This code is not compiled:

    Code:
    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 CacheItemUpdate Callback to Function CacheItemUpdate Callback
    it also is not compiled

    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:

    Code:
    InsertItemInCache(cachedItem, dependency, key, Function(k, r, e, d, a, s) CacheItemUpdateCallbackNew(k, r, e, d, a, s, additionalParameter1, additionalParameter2, additionalParameter3))
Working...