Creating Threads
You create a new thread for performing an operation with an instance of the System.Threading.Thread
class. The constructor of this class requires you to also specify an instance of the System.Threading.ThreadStart
delegate that simply points to a method that can actually do the work. Then you simply invoke the Thread.Start
instance method. The following code snippet demonstrates how you can create a new thread:
To actually start the new thread, you invoke the method that encapsulates the thread instance, which in this case is simpleThread
.
Creating Threads with Lambda Expressions
You might recall from Chapter 21, “Advanced Language ...
Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.