473,321 Members | 1,667 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

VB lambda expression for sub delegate

There is the code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub InsertItemInCache(Of T)(ByVal item As CachedItem(Of T), ByVal dependency As AggregateCacheDependency, _
  2. ByVal key As String, ByVal updateCallBack As CacheItemUpdateCallback)
The signature of CacheItemUpdateCallback is:

Expand|Select|Wrap|Line Numbers
  1. Sub CacheItemUpdateCallback(ByVal key As String, ByVal reason As CacheItemUpdateReason, _
  2. ByRef expensiveObject As Object, ByRef dependency As CacheDependency, ByRef absoluteExpiration As Date, _
  3. ByRef slidingExpiration As TimeSpan)

I want to call InsertItemInCache function using lamba expression for this.
This code is not compiled:

Expand|Select|Wrap|Line Numbers
  1. 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

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:

Expand|Select|Wrap|Line Numbers
  1. InsertItemInCache(cachedItem, dependency, key, Function(k, r, e, d, a, s) CacheItemUpdateCallbackNew(k, r, e, d, a, s, additionalParameter1, additionalParameter2, additionalParameter3))
Nov 29 '10 #1
0 879

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Matthias Kaeppler | last post by:
Hi, in my program, I have this funtion to compute the sum of a bunch of files: Glib::ustring DirBrowser::get_total_file_size() { using namespace boostfs; // boostfs = boost::filesystem using...
3
by: rammel | last post by:
hi, can't I call member functions from an placeholder of a boost-like lambda expression? look on the example below please: -----------------------------------------------------------...
15
by: Matt | last post by:
Hi There, Can anyone explain me the real advantages of (other than syntax) lambda expressions over anonymous delegates? advantage for one over the other. delegate int F(int a); F fLambda = a...
2
by: =?Utf-8?B?UnV0aCBNYXJr?= | last post by:
Hey, Am trying to write a lambda expression for a delegate, am getting an error as ------------------------------ only assignment, call, increment, decrement, and new expression can be used as...
0
by: sneha0608 | last post by:
I am using LINQ.I want to dynamically build a lambda expression which would be passed to the where clause of the Query. i have written the following code: ParameterExpression param =...
5
by: Satish | last post by:
When i compile this function I get the error Cannot convert lambda expression of type System.delegate because it is not a delegate type. private void SetStatus(string status) { if...
8
by: Simon Woods | last post by:
Hi A blog post I was reading (http://www.defmacro.org/ramblings/fp.html) included this lambda function. Function makeIncrementer() { int n = 0; int increment() { return ++n;
3
by: Marc Gravell | last post by:
A lambda expression is a short form to write a delegate In /this/ case (LINQ-to-Objects): yes - but it could equally be compiled to an Expression, which is very, very different. A lambda...
2
by: Colin Han | last post by:
Hi, all, If I write follow code in c# method. The IDE will compile it to a complex construct method of System.Linq.Expression. Expression<Func<int>ex = () =10; will be compile to:...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.