|
-
Mar 3rd, 2011, 12:30 PM
#5
Thread Starter
Fanatic Member
Re: Question about Lamda Expression
Yap. I realized why putting dim x=i in the loop works.
I was told a long time ago that in VB6, no matter where you put the dim statement, variables are always allocated at the beginning of the function. Not so in vb.net
That's my first question actually.
The way closure works is vb.net will make a special class and all local variables will be a member of that class. Which I think is quite an inefficient way to do so. I think a member of that closure class should change only when the delegate is created or assigned.
So my second question is the design choice. Why Microsoft decided to change the member closure class every time the local variable change? Why not just once?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|