Convert anonymous method/lambda from C# to VB.NET (3.5)

resourcesys
resourcesys used Ask the Experts™
on
Hi all,

I need assistance to convert the following C# code to VB.NET (ASP.NET 3.5)

            EventHandler<WorkflowCompletedEventArgs> d  = null;
            d = delegate(object o, WorkflowCompletedEventArgs e)
            {
                if (e.WorkflowInstance.InstanceId ==wi.InstanceId)
                {
                    wr.WorkflowCompleted -= d;
                    WorkflowInstance c = wr.GetWorkflow(caller);
                    c.EnqueueItem(qn, e.OutputParameters, null, null);
                }
            };

Any help is greatly appreciated.

Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Technical Project Manager
Commented:
try this

Dim d As EventHandler(Of WorkflowCompletedEventArgs) = Nothing
d = Function(o As Object, e As WorkflowCompletedEventArgs) Do
	If e.WorkflowInstance.InstanceId = wi.InstanceId Then
		wr.WorkflowCompleted -= d
		Dim c As WorkflowInstance = wr.GetWorkflow(caller)
		c.EnqueueItem(qn, e.OutputParameters, Nothing, Nothing)
	End If
End Function

Open in new window

Author

Commented:
Hi praveenvenu,

Unfortunately, that didn't, you can't call an anonymous function that way in VB.NET.

Thanks for the response.

Author

Commented:
Solution was not provided, just information on the topic.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial