Async in C# 5.0
Unleash the Power of Async
Paperback Engels 2012 9781449337162Samenvatting
If you're writing one of several applications that call for asynchronous programming, this concise hands-on guide shows you how the async feature in C# 5.0 can make the process much simpler. Along with a clear introduction to asynchronous programming, you get an in-depth look at how the async feature works and why you might want to use it in your application.
Written for experienced C# programmers-yet approachable for beginners-this book is packed with code examples that you can extend for your own projects.
- Write your own asynchronous code, and learn how async saves you from this messy chore
- Discover new performance possibilities in ASP.NET web server code
- Explore how async and WinRT work together in Windows 8 applications
- Learn the importance of the await keyword in async methods
- Understand which .NET thread is running your code-and at what points in the program
- Use the Task-based Asynchronous Pattern (TAP) to write asynchronous APIs in .NET
- Take advantage of parallel computing in modern machines
- Measure async code performance by comparing it with alternatives
Specificaties
Lezersrecensies
Inhoudsopgave
1. Introduction
-Asynchronous Programming
-What's So Great About Asynchronous Code?
-What Is Async?
-What Async Does
-Async Doesn't Solve Everything
2. Why Programs Need to Be Asynchronous
-Desktop User Interface Applications
-Web Application Server Code
-Silverlight, Windows Phone, and Windows 8
-Parallel Code
-An Example
3. Writing Asynchronous Code Manually
-Some Asynchronous Patterns Used in .NET
-The Simplest Asynchronous Pattern
-An Introduction to Task
-The Problem with Manual Asynchrony
-Converting the Example to Use Manual Asynchronous Code
4. Writing Async Methods
-Converting the Favicon Example to Async
-Task and await
-Async Method Return Types
-Async, Method Signatures, and Interfaces
-The return Statement in Async Methods
-Async Methods Are Contagious
-Async Anonymous Delegates and Lambdas
5. What await Actually Does
-Hibernating and Resuming a Method
-The State of the Method
-Context
-Where await Can't Be Used
-Exception Capture
-Async Methods Are Synchronous Until Needed
6. The Task-Based Asynchronous Pattern
-What the TAP Specifies
-Using Task for Compute-Intensive Operations
-Creating a Puppet Task
-Interacting with Old Asynchronous Patterns
-Cold and Hot Tasks
-Up-Front Work
7. Utilities for Async Code
-Delaying for a Period of Time
-Waiting for a Collection of Tasks
-Waiting for Any One Task from a Collection
-Creating Your Own Combinators
-Cancelling Asynchronous Operations
-Returning Progress During an Asynchronous Operation
8. Which Thread Runs My Code?
-Before the First await
-During the Asynchronous Operation
-SynchronizationContext in Detail
-await and SynchronizationContext
-The Lifecycle of an Async Operation
-Choosing Not to Use SynchronizationContext
-Interacting with Synchronous Code
9. Exceptions in Async Code
-Exceptions in Async Task-Returning Methods
-Unobserved Exceptions
-Exceptions in Async void Methods
-Fire and Forget
-AggregateException and WhenAll
-Throwing Exceptions Synchronously
-finally in Async Methods
10. Parallelism Using Async
-await and locks
-Actors
-Using Actors in C#
-Task Parallel Library Dataflow
11. Unit Testing Async Code
-The Problem with Unit Testing in Async
-Writing Working Async Tests Manually
-Using Unit Test Framework Support
12. Async in ASP.NET Applications
-Advantages of Asynchronous Web Server Code
-Using Async in ASP.NET MVC 4
-Using Async in Older Versions of ASP.NET MVC
-Using Async in ASP.NET Web Forms
13. Async in WinRT Applications
-What Is WinRT?
-IAsyncAction and IAsyncOperation<T>
-Cancellation
-Progress
-Providing Asynchronous Methods in a WinRT Component
14. The Async Compiler Transform-in Depth
-The stub Method
-The State Machine Struct
-The MoveNext Method
-Writing Custom Awaitable Types
-Interacting with the Debugger
15. The Performance of Async Code
-Measuring Async Overhead
-Async Versus Blocking for a Long-Running Operation
-Optimizing Async Code for a Long-Running Operation
-Async Versus Manual Asynchronous Code
-Async Versus Blocking Without a Long-Running Operation
-Optimizing Async Code Without a Long-Running Operation
-Async Performance Summary
Rubrieken
- advisering
- algemeen management
- coaching en trainen
- communicatie en media
- economie
- financieel management
- inkoop en logistiek
- internet en social media
- it-management / ict
- juridisch
- leiderschap
- marketing
- mens en maatschappij
- non-profit
- ondernemen
- organisatiekunde
- personal finance
- personeelsmanagement
- persoonlijke effectiviteit
- projectmanagement
- psychologie
- reclame en verkoop
- strategisch management
- verandermanagement
- werk en loopbaan