Solved

C# Action a = () => {} what is this in vb.net

Posted on 2011-03-02
4
388 Views
Last Modified: 2012-06-27
Hi I got this code

Action a
        = () =>
            {
              //Do something
              }
            };

Is this creating a new thread, and how to do it in VB.net...
0
Comment
Question by:JSW21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 8

Assisted Solution

by:crysallus
crysallus earned 100 total points
ID: 35024430
No, its not creating a new thread. It's called a lambda expression. Some reading:

http://msdn.microsoft.com/en-us/library/bb397687.aspx

http://msdn.microsoft.com/en-us/library/018hxwa8.aspx

How to do lambda expressions in VB:

http://msdn.microsoft.com/en-us/library/bb531253.aspx#Y228
0
 
LVL 9

Assisted Solution

by:mayank_joshi
mayank_joshi earned 100 total points
ID: 35024829
0
 
LVL 7

Accepted Solution

by:
vbigham earned 300 total points
ID: 35029519
Here is a direct translation:
 
Dim a As Action = _
                    Sub()
                        ' Do Something '
                    End Sub

' You can invoke the code inside the Sub() by calling the actions Invoke method. '
a.Invoke()

Open in new window

0
 

Author Closing Comment

by:JSW21
ID: 35213112
Direct translation is making lots of sense.
Thanks,
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question