Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3484548
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T10:48:03+00:00 2026-05-18T10:48:03+00:00

There is the code: Private Sub InsertItemInCache(Of T)(ByVal item As CachedItem(Of T), ByVal dependency

  • 0

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 signature of CacheItemUpdateCallback 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))
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T10:48:04+00:00Added an answer on May 18, 2026 at 10:48 am

    How about this?

    InsertItemInCache(cachedItem, dependency, key, _
      Sub(k, r, e, d, a, s) CacheItemUpdateCallback(k, r, e, d, a, s)) 
    

    I think this will only work in VB.Net 2010. As far as I can remember earlier versions did not support Sub lambdas.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is the code: Private Sub InsertItemInCache(Of T)(ByVal item As CachedItem(Of T), ByVal dependency
There's some code in our project that looks a bit like this: Private Sub
Consider the following code: Dim Working As Boolean = False Private Sub TreeView1_AfterCheck(ByVal sender
First off, let me provide you with my code: Private Sub txtLatMin_Exit(ByVal Cancel As
Right now, I have code that looks something like this: Private Sub ShowReport(ByVal reportName
Is there something wrong with the following code (in an ADP form) ? Private
I have the following code: Private Sub Tabstrip1_Click() Form2.Show vbModal, Me end sub Form2
I have this method: Private Sub SetIfNotNull(ByVal input As Object, ByRef destination As Object,
There is code for save button, but I can't see any code behind the
In my code there are a lot of final values, like 10000. They never

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.