Hi all,
I've been wondering about lambda expressions for a while now.
Consider the following code
Bothvb.net Code:
Sub Main() Dim I As Integer SomeUselessSub(Sub() Dim K As Integer = I End Sub) SomeUselessSub(New Action(AddressOf DoSomething)) End Sub Sub DoSomething() End Sub Sub SomeUselessSub(ByVal D As [Delegate]) End Sub
AndCode:SomeUselessSub(Sub() Dim K As Integer = I End Sub)
Are valid calls to SomeUselessSub.Code:SomeUselessSub(New Action(AddressOf DoSomething))
But in the lambda expression I have access to all Sub Main's variables. Is it safe to use them ?




Reply With Quote
