03.01.2015 Views

C# 5.0 Programmer's Reference

Visual Studio 2013 C# 5.0 Programmer's Reference

Visual Studio 2013 C# 5.0 Programmer's Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Asynchronous Methods ❘ 141<br />

This method counts to an indicated value displaying numbers in the Console window and sleeping<br />

1 second between each number.<br />

The following code runs the Count method asynchronously.<br />

// Start the Count method on a new thread.<br />

Action countDelegate = Count;<br />

IAsyncResult result = countDelegate.BeginInvoke(5, null, null);<br />

// Count to 3.<br />

for (int i = 1; i

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!