CONTENTS
The Role of the Parallel Class............................................................................................................... 732
Data Parallelism with the Parallel Class............................................................................................... 733
Accessing UI Elements on Secondary Threads..................................................................................... 735
The Task Class...................................................................................................................................... 736
Handling Cancellation Request............................................................................................................. 736
Task Parallelism Using the Parallel Class............................................................................................. 738
Parallel LINQ Queries (PLINQ) ........................................................................................741
Opting in to a PLINQ Query ................................................................................................................... 743
Cancelling a PLINQ Query ..................................................................................................................... 743
Asynchronous Calls Under .NET 4.5...............................................................................744
A First Look at the C# async and await Keywords ............................................................................... 744
Naming Conventions for Async Methods.............................................................................................. 746
Async Methods Returning Void............................................................................................................. 748
Async Methods with Multiple Awaits.................................................................................................... 748
Retrofitting the AddWithThreads Example Using Asycn/Await............................................................. 749
Summary .......................................................................................................................751
Chapter 20: File I/O and Object Serialization......................................................753
Exploring the System.IO Namespace.............................................................................753
The Directory(Info) and File(Info) Types.........................................................................754
The Abstract FileSystemInfo Base Class .............................................................................................. 755
Working with the DirectoryInfo Type .............................................................................756
Enumerating Files with the DirectoryInfo Type .................................................................................... 758
Creating Subdirectories with the DirectoryInfo Type............................................................................ 758
Working with the Directory Type ...................................................................................760
Working with the DriveInfo Class Type ..........................................................................760
Working with the FileInfo Class .....................................................................................762
The FileInfo.Create() Method ................................................................................................................ 763
xxx