![]() CATEGORIES: BiologyChemistryConstructionCultureEcologyEconomyElectronicsFinanceGeographyHistoryInformaticsLawMathematicsMechanicsMedicineOtherPedagogyPhilosophyPhysicsPolicyPsychologySociologySportTourism |
Chapter 23 Assembly Loading and Reflection 583Assembly Loading........................................................................................ 584 Using Reflection to Build a Dynamically Extensible Application.......... 588 Reflection Performance............................................................................... 589 Discovering Types Defined in an Assembly.................................. 590 What Exactly Is a Type Object?........................................................ 591 Building a Hierarchy of Exception-Derived Types........................ 593 Constructing an Instance of a Type................................................. 594 Designing an Application That Supports Add-Ins................................... 596 Using Reflection to Discover a Type’s Members..................................... 599 Discovering a Type’s Members....................................................... 599 Invoking a Type’s Members.............................................................. 603 Using Binding Handles to Reduce Your Process’s Memory Consumption....................................................................... 608 Chapter 24 Runtime Serialization 611 Serialization/Deserialization Quick Start................................................... 613 Making a Type Serializable......................................................................... 617 Controlling Serialization and Deserialization.......................................... 619 How Formatters Serialize Type Instances................................................ 623 Controlling the Serialized/Deserialized Data........................................... 624 How to Define a Type That Implements ISerializable When the Base Type Doesn’t Implement This Interface............. 630 Streaming Contexts...................................................................................... 631 Serializing a Type As a Different Type and Deserializing an Object As a Different Object............................................................. 633 Serialization Surrogates............................................................................... 636 Surrogate Selector Chains................................................................ 639 Overriding the Assembly and/or Type When Deserializing an Object.................................................................................................... 640
Contents xvii
Chapter 25 Interoperating with WinRT Components 643 CLR Projections and WinRT Component Type System Rules................ 645 WinRT Type System Core Concepts............................................... 645 Framework Projections................................................................................ 649 Calling Asynchronous WinRT APIs from .NET Code................... 649 Interoperating Between WinRT Streams and .NET Streams........ 654 Passing Blocks of Data Between the CLR and WinRT................... 656 Defining WinRT Components in C#.......................................................... 658
Chapter 26 Thread Basics 669 Why Does Windows Support Threads?..................................................... 669 Thread Overhead.......................................................................................... 670 Stop the Madness......................................................................................... 674 CPU Trends.................................................................................................... 677 CLR Threads and Windows Threads......................................................... 678 Using a Dedicated Thread to Perform an Asynchronous Compute-Bound Operation.................................................................... 678 Reasons to Use Threads.............................................................................. 681 Thread Scheduling and Priorities............................................................... 683 Foreground Threads vs. Background Threads........................................ 688 What Now?..................................................................................................... 689 Chapter 27 Compute-Bound Asynchronous Operations 691 Introducing the CLR’s Thread Pool............................................................ 692 Performing a Simple Compute-Bound Operation.................................. 693 Execution Contexts....................................................................................... 694 Cooperative Cancellation and Timeout.................................................... 696 Tasks................................................................................................................ 700 Waiting for a Task to Complete and Getting Its Result................. 702 Canceling a Task................................................................................ 704 Xviii Contents
Starting a New Task Automatically When Another Task Completes................................................................................. 705 A Task May Start Child Tasks............................................................ 707 Inside a Task........................................................................................ 707 Task Factories..................................................................................... 709 Task Schedulers................................................................................. 711 Parallel’s Static For, ForEach, and Invoke Methods................ 713 Parallel Language Integrated Query......................................................... 717 Performing a Periodic Compute-Bound Operation.............................. 720 So Many Timers, So Little Time....................................................... 723 How the Thread Pool Manages Its Threads............................................. 723 Setting Thread Pool Limits............................................................... 724 How Worker Threads Are Managed............................................... 724 Date: 2016-03-03; view: 823
|