Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2011-03-02
4
Medium Priority
?
391 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 400 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 400 total points
ID: 35024829
0
 
LVL 7

Accepted Solution

by:
vbigham earned 1200 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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

610 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