Async Feature from C# 5
Tutorial notes and examples are provided on the Async feature introduced in C# 5. Topics include introduction of Async feature; Asynchronous operations from the HttpClient class; 'await' expression examples; 'async' function examples.
What Is Async Feature?
GetStringAsync() Method in HttpClient Class
GetStringAsync() Method Example Program
Watching Asynchronous Operation Execution Status
"await" Expression and Child Thread
"await" Expression Thread Example
"async" Function Example
- The Async feature allows us to create asynchronous tasks with child threads
with 2 keywords: "await" and "async".
- "await" represents an "await" expression on an awaitable task.
- Evaluation of an "await" expression launches a new child thread to
wait for the task to finish and continue with remaining statement of the current method.
- The calling thread of an "await" expression exits the current method immediately.
- "async" represents an "async" function that contains "await" expressions.
- "async" functions can not have any "ref" or "out" parameters.
- "async" functions must use void or Task<T> as the return type.
Table of Contents
About This Book
Introduction of C# (C Sharp)
Data Type and Variables
Logical Expressions and Conditional Statements
Arrays and Loop Statements
Data Type Features
Floating-Point Data Types
Passing Parameters to Methods
Execution Environment Class
Visual C# 2010 Express Edition
C# Compiler and Intermediate Language
Compiling C# Source Code Files
MSBuild - Microsoft Build Engine
Memory Usages of Processes
Multithreading in C#
►Async Feature from C# 5
WPF - Windows Presentation Foundation
Partial Classes and Partial Methods
PDF Printing Version