Troelsen | Pro C# 2010 and the .NET 4 Platform | E-Book | www.sack.de
E-Book

E-Book, Englisch, 1752 Seiten

Troelsen Pro C# 2010 and the .NET 4 Platform


5th ed
ISBN: 978-1-4302-2550-8
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark

E-Book, Englisch, 1752 Seiten

ISBN: 978-1-4302-2550-8
Verlag: Apress
Format: PDF
Kopierschutz: 1 - PDF Watermark



The first edition of this book was released at the 2001 Tech-Ed conference in Atlanta, Georgia. At that time, the .NET platform was still a beta product, and in many ways, so was this book. This is not to say that the early editions of this text did not have merit-after all, the book was a 2002 Jolt Award finalist and it won the 2003 Referenceware Excellence Award. However, over the years that author Andrew Troelsen spent working with the common language runtime (CLR), he gained a much deeper understanding of the .NET platform and the subtleties of the C# programming language, and he feels that this fifth edition of the book is as close to a 'final release' as he's come yet. This new edition has been comprehensively revised and rewritten to make it accurately reflect the C# 4 language specification for the .NET 4 platform. You'll find new chapters covering the important concepts of dynamic lookups, named and optional arguments, Parallel LINQ (PLINQ), improved COM interop, and variance for generics. If you're checking out this book for the first time, do understand that it's targeted at experienced software professionals and/or graduate students of computer science (so don't expect three chapters on iteration or decision constructs!). The mission of this text is to provide you with a rock-solid foundation in the C# programming language and the core aspects of the .NET platform (assemblies, remoting, Windows Forms, Web Forms, ADO.NET, XML web services, etc.). Once you digest the information presented in these 25 chapters, you'll be in a perfect position to apply this knowledge to your specific programming assignments, and you'll be well equipped to explore the .NET universe on your own terms.

Andrew Troelsen is a partner, trainer, and consultant at Intertech Inc., and is a leading authority on both .NET and COM. His book Pro C# 2005 and the .NET 2.0 Platform won the prestigious 2003 Referenceware Excellence Award and is in its third edition. Also of note are his earlier five-star treatment of traditional COM in the bestselling Developer's Workshop to COM and ATL mirrored in his book, COM and .NET Interoperability, and his top-notch investigation of VB .NET in Visual Basic .NET and the .NET Platform: An Advanced Guide. Troelsen has a degree in mathematical linguistics and South Asian studies from the University of Minnesota, and is a frequent speaker at numerous .NET-related conferences. He currently lives in Minneapolis with his wife, Amanda, and spends his free time investigating .NET and waiting for the Wild to win the Stanley Cup. You can check out his blog at AndrewTroelsen.blogspot.com.

Troelsen Pro C# 2010 and the .NET 4 Platform jetzt bestellen!

Autoren/Hrsg.


Weitere Infos & Material


1;Title Page
;1
2;Copyright Page
;2
3;Contents at a Glance;4
4;Table of Contents
;7
5;About the Author;24
6;About the Technical Reviewer;25
7;Acknowledgments;26
8;Introduction;27
8.1;We’re a Team, You and I;28
8.2;An Overview of This Book;28
8.2.1;Part 1: Introducing C# and the .NET Platform;29
8.2.2;Part 2: Core C# Programming Constructs;29
8.2.3;Part 3: Advanced C# Programming Constructs;30
8.2.4;Part 4: Programming with .NET Assemblies;31
8.2.5;Part 5: Introducing the .NET Base Class Libraries;32
8.2.6;Part 6: Building Desktop User Interfaces using WPF;34
8.2.7;Part 7: Building Web Applications with ASP.NET;35
8.2.8;Part 8: Appendixes;36
8.3;Obtaining This Book’s Source Code;36
8.4;Obtaining Updates for This Book;37
8.5;Contacting Me;37
9;PART 1 Introducing C# and the .NET Platform
;38
10;CHAPTER 1 The Philosophy of .NET
;39
10.1;Understanding the Previous State of Affairs;39
10.1.1;Life As a C/Windows API Programmer;40
10.1.2;Life As a C++/MFC Programmer;40
10.1.3;Life As a Visual Basic 6.0 Programmer;40
10.1.4;Life As a Java Programmer;41
10.1.5;Life As a COM Programmer;41
10.1.5.1;The Complexity of COM Data Type Representation;42
10.2;The .NET Solution;42
10.3;Introducing the Building Blocks of the .NET Platform (the CLR, CTS, and CLS)
;43
10.3.1;The Role of the Base Class Libraries;44
10.3.2;What C# Brings to the Table;44
10.4;Additional .NET-Aware Programming Languages;46
10.4.1;Life in a Multi-Language World;48
10.5;An Overview of .NET Assemblies;48
10.5.1;Single-File and Multi-File Assemblies;50
10.5.2;The Role of the Common Intermediate Language;50
10.5.2.1;Benefits of CIL;52
10.5.2.2;Compiling CIL to Platform-Specific Instructions;53
10.5.3;The Role of .NET Type Metadata;53
10.5.4;The Role of the Assembly Manifest;54
10.6;Understanding the Common Type System;55
10.6.1;CTS Class Types;55
10.6.2;CTS Interface Types;56
10.6.3;CTS Structure Types;56
10.6.4;CTS Enumeration Types;57
10.6.5;CTS Delegate Types;57
10.6.6;CTS Type Members;58
10.6.7;Intrinsic CTS Data Types;58
10.7;Understanding the Common Language Specification;59
10.7.1;Ensuring CLS Compliance;61
10.8;Understanding the Common Language Runtime;61
10.9;The Assembly/Namespace/Type Distinction;63
10.9.1;The Role of the Microsoft Root Namespace;66
10.9.2;Accessing a Namespace Programmatically;66
10.9.3;Referencing External Assemblies;68
10.10;Exploring an Assembly Using ildasm.exe;69
10.10.1;Viewing CIL Code;70
10.10.2;Viewing Type Metadata;70
10.10.3;Viewing Assembly Metadata (aka the Manifest);71
10.11;Exploring an Assembly Using Reflector;71
10.12;Deploying the .NET Runtime;72
10.12.1;The .NET Client Profile Runtime;73
10.13;The Platform-Independent Nature of .NET;73
10.14;Summary;75
11;CHAPTER 2 Building C# Applications
;76
11.1;The Role of the .NET Framework 4.0 SDK;76
11.1.1;The Visual Studio 2010 Command Prompt;77
11.2;Building C# Applications Using csc.exe;77
11.2.1;Specifying Input and Output Targets;78
11.2.2;Referencing External Assemblies;80
11.2.3;Referencing Multiple External Assemblies;81
11.2.4;Compiling Multiple Source Files;81
11.2.5;Working with C# Response Files;82
11.2.5.1;The Default Response File (csc.rsp);83
11.3;Building .NET Applications Using Notepad++;84
11.4;Building .NET Applications Using SharpDevelop;85
11.4.1;Building a Simple Test Project;86
11.5;Building .NET Applications Using Visual C# 2010 Express;88
11.5.1;Some Unique Features of Visual C# 2010 Express;88
11.6;Building .NET Applications Using Visual Studio 2010;89
11.6.1;Some Unique Features of Visual Studio 2010;90
11.6.2;Targeting the .NET Framework Using the New Project Dialog Box;91
11.6.3;Using the Solution Explorer Utility;91
11.6.3.1;Referencing External Assemblies;92
11.6.3.2;Viewing Project Properties;93
11.6.4;The Class View Utility;93
11.6.5;The Object Browser Utility;95
11.6.6;Integrated Support for Code Refactoring;95
11.6.7;Code Expansions and Surround With Technology;98
11.6.8;The Visual Class Designer;99
11.6.9;The Integrated .NET Framework 4.0 SDK Documentation System;102
11.7;Summary;104
12;PART 2 Core C# Programming Constructs
;105
13;CHAPTER 3 Core C# Programming Constructs, Part I
;106
13.1;The Anatomy of a Simple C# Program;106
13.1.1;Variations on the Main() Method;108
13.1.2;Specifying an Application Error Code;109
13.1.3;Processing Command-Line Arguments;110
13.1.4;Specifying Command-Line Arguments with Visual Studio 2010;112
13.2;An Interesting Aside: Some Additional Members of the System.Environment Class
;112
13.3;The System.Console Class;114
13.3.1;Basic Input and Output with the Console Class;115
13.3.2;Formatting Console Output;116
13.3.3;Formatting Numerical Data;117
13.3.4;Formatting Numerical Data Beyond Console Applications;118
13.4;System Data Types and C# Shorthand Notation;119
13.4.1;Variable Declaration and Initialization;121
13.4.2;Intrinsic Data Types and the new Operator;122
13.4.3;The Data Type Class Hierarchy;123
13.4.4;Members of Numerical Data Types;125
13.4.5;Members of System.Boolean;126
13.4.6;Members of System.Char;126
13.4.7;Parsing Values from String Data;127
13.4.8;System.DateTime and System.TimeSpan;128
13.4.9;The .NET 4.0 System.Numerics Namespace;128
13.5;Working with String Data;130
13.5.1;Basic String Manipulation;131
13.5.2;String Concatenation;132
13.5.3;Escape Characters;133
13.5.4;Defining Verbatim Strings;134
13.5.5;Strings and Equality;135
13.5.6;Strings Are Immutable;135
13.5.7;The System.Text.StringBuilder Type;137
13.6;Narrowing and Widening Data Type Conversions;139
13.6.1;Trapping Narrowing Data Conversions;141
13.6.2;Setting Project-wide Overflow Checking;143
13.6.3;The unchecked Keyword;144
13.6.4;The Role of System.Convert;145
13.7;Understanding Implicitly Typed Local Variables;145
13.7.1;Restrictions on Implicitly Typed Variables;147
13.7.2;Implicit Typed Data Is Strongly Typed Data;148
13.7.3;Usefulness of Implicitly Typed Local Variables;149
13.8;C# Iteration Constructs;150
13.8.1;The for Loop;150
13.8.2;The foreach Loop;151
13.8.2.1;Use of var Within foreach Constructs;151
13.8.3;The while and do/while Looping Constructs;152
13.9;Decision Constructs and the Relational/Equality Operators;152
13.9.1;The if/else Statement;153
13.9.2;The switch Statement;154
13.10;Summary;155
14;CHAPTER 4 Core C# Programming Constructs, Part II
;157
14.1;Methods and Parameter Modifiers;157
14.1.1;The Default Parameter-Passing Behavior;158
14.1.2;The out Modifier;159
14.1.3;The ref Modifier;160
14.1.4;The params Modifier;162
14.1.5;Defining Optional Parameters;163
14.1.6;Invoking Methods using Named Parameters;165
14.1.7;Understanding Method Overloading;167
14.2;Understanding C# Arrays;169
14.2.1;C# Array Initialization Syntax;170
14.2.2;Implicitly Typed Local Arrays;171
14.2.3;Defining an Array of Objects;171
14.2.4;Working with Multidimensional Arrays;172
14.2.5;Arrays As Arguments or Return Values;174
14.2.6;The System.Array Base Class;174
14.3;Understanding the Enum Type;176
14.3.1;Controlling the Underlying Storage for an Enum;177
14.3.2;Declaring Enum Variables;178
14.3.3;The System.Enum Type;179
14.3.4;Dynamically Discovering an Enum’s Name/Value Pairs;180
14.4;Understanding the Structure Type;183
14.4.1;Creating Structure Variables;184
14.5;Understanding Value Types and Reference Types;186
14.5.1;Value Types, References Types, and the Assignment Operator;187
14.5.2;Value Types Containing Reference Types;189
14.5.3;Passing Reference Types by Value;190
14.5.4;Passing Reference Types by Reference;192
14.5.5;Final Details Regarding Value Types and Reference Types;193
14.6;Understanding C# Nullable Types;194
14.6.1;Working with Nullable Types;195
14.6.2;The ?? Operator;196
14.7;Summary;197
15;CHAPTER 5 Defining Encapsulated Class Types
;198
15.1;Introducing the C# Class Type;198
15.1.1;Allocating Objects with the new Keyword;201
15.2;Understanding Constructors;201
15.2.1;The Role of the Default Constructor;202
15.2.2;Defining Custom Constructors;203
15.2.3;The Default Constructor Revisited;204
15.3;The Role of the this Keyword;205
15.3.1;Chaining Constructor Calls Using this;207
15.3.2;Observing Constructor Flow;209
15.3.3;Revisiting Optional Arguments;211
15.4;Understanding the static Keyword;212
15.4.1;Defining Static Methods;212
15.4.2;Defining Static Field Data;213
15.4.3;Defining Static Constructors;216
15.4.4;Defining Static Classes;218
15.5;Defining the Pillars of OOP;219
15.5.1;The Role of Encapsulation;220
15.5.2;The Role of Inheritance;220
15.5.3;The Role of Polymorphism;222
15.6;C# Access Modifiers;223
15.6.1;The Default Access Modifiers;224
15.6.2;Access Modifiers and Nested Types;225
15.7;The First Pillar: C#’s Encapsulation Services;225
15.7.1;Encapsulation Using Traditional Accessors and Mutators;226
15.7.2;Encapsulation Using .NET Properties;229
15.7.3;Using Properties within a Class Definition;231
15.7.4;Internal Representation of Properties;233
15.7.5;Controlling Visibility Levels of Property Get/Set Statements;235
15.7.6;Read-Only and Write-Only Properties;235
15.7.7;Static Properties;236
15.8;Understanding Automatic Properties;237
15.8.1;Interacting with Automatic Properties;239
15.8.2;Regarding Automatic Properties and Default Values;239
15.9;Understanding Object Initializer Syntax;241
15.9.1;Calling Custom Constructors with Initialization Syntax;243
15.9.2;Initializing Inner Types;244
15.10;Working with Constant Field Data;245
15.10.1;Understanding Read-Only Fields;246
15.10.2;Static Read-Only Fields;247
15.11;Understanding Partial Types;248
15.12;Summary;249
16;CHAPTER 6 Understanding Inheritance and Polymorphism
;250
16.1;The Basic Mechanics of Inheritance;250
16.1.1;Specifying the Parent Class of an Existing Class;251
16.1.2;Regarding Multiple Base Classes;253
16.1.3;The sealed Keyword;253
16.2;Revising Visual Studio Class Diagrams;255
16.3;The Second Pillar of OOP: The Details of Inheritance;257
16.3.1;Controlling Base Class Creation with the base Keyword;259
16.3.2;Keeping Family Secrets: The protected Keyword;261
16.3.3;Adding a Sealed Class;262
16.4;Programming for Containment/Delegation;263
16.4.1;Understanding Nested Type Definitions;264
16.5;The Third Pillar of OOP: C#’s Polymorphic Support;266
16.5.1;The virtual and override Keywords;267
16.5.2;Overriding Virtual Members Using Visual Studio 2010;269
16.5.3;Sealing Virtual Members;270
16.5.4;Understanding Abstract Classes;271
16.5.5;Understanding the Polymorphic Interface;272
16.5.6;Understanding Member Shadowing;276
16.6;Understanding Base Class/Derived Class Casting Rules;278
16.6.1;The C# as Keyword;280
16.6.2;The C# is Keyword;281
16.7;The Master Parent Class: System.Object;281
16.7.1;Overriding System.Object.ToString();285
16.7.2;Overriding System.Object.Equals();285
16.7.3;Overriding System.Object.GetHashCode();286
16.7.4;Testing Your Modified Person Class;287
16.7.5;The Static Members of System.Object;288
16.8;Summary;289
17;CHAPTER 7 Understanding Structured Exception Handling
;290
17.1;Ode to Errors, Bugs, and Exceptions;290
17.2;The Role of .NET Exception Handling;291
17.2.1;The Atoms of .NET Exception Handling;292
17.2.2;The System.Exception Base Class;292
17.3;The Simplest Possible Example;294
17.3.1;Throwing a General Exception;296
17.3.2;Catching Exceptions;297
17.4;Configuring the State of an Exception;298
17.4.1;The TargetSite Property;299
17.4.2;The StackTrace Property;299
17.4.3;The HelpLink Property;300
17.4.4;The Data Property;301
17.5;System-Level Exceptions (System.SystemException);303
17.6;Application-Level Exceptions (System.ApplicationException);304
17.6.1;Building Custom Exceptions, Take One;304
17.6.2;Building Custom Exceptions, Take Two;306
17.6.3;Building Custom Exceptions, Take Three;307
17.7;Processing Multiple Exceptions;308
17.7.1;General catch Statements;310
17.7.2;Rethrowing Exceptions;311
17.7.3;Inner Exceptions;312
17.7.4;The Finally Block;313
17.8;Who Is Throwing What?;313
17.9;The Result of Unhandled Exceptions;314
17.10;Debugging Unhandled Exceptions Using Visual Studio;315
17.11;A Brief Word Regarding Corrupted State Exceptions (CSE);316
17.12;Summary;318
18;CHAPTER 8 Understanding Object Lifetime
;319
18.1;Classes, Objects, and References;319
18.2;The Basics of Object Lifetime;321
18.2.1;The CIL of new;322
18.2.2;Setting Object References to null;323
18.3;The Role of Application Roots;324
18.4;Understanding Object Generations;326
18.5;Concurrent Garbage Collection under .NET 1.0 - 3.5;327
18.5.1;Background Garbage Collection under .NET 4.0;327
18.6;The System.GC Type;328
18.6.1;Forcing a Garbage Collection;329
18.7;Building Finalizable Objects;332
18.7.1;Overriding System.Object.Finalize();333
18.7.2;Detailing the Finalization Process;335
18.8;Building Disposable Objects;335
18.8.1;Reusing the C# using Keyword;338
18.9;Building Finalizable and Disposable Types;339
18.9.1;A Formalized Disposal Pattern;340
18.10;Understanding Lazy Object Instantiation;343
18.10.1;Customizing the Creation of the Lazy Data;345
18.11;Summary;346
19;PART 3 Advanced C# Programming Constructs
;348
20;CHAPTER 9 Working with Interfaces
;349
20.1;Understanding Interface Types;349
20.1.1;Interface Types vs. Abstract Base Classes;350
20.2;Defining Custom Interfaces;353
20.3;Implementing an Interface;355
20.4;Invoking Interface Members at the Object Level;357
20.4.1;Obtaining Interface References: The as Keyword;358
20.4.2;Obtaining Interface References: The is Keyword;358
20.5;Interfaces As Parameters;359
20.6;Interfaces As Return Values;361
20.7;Arrays of Interface Types;362
20.8;Implementing Interfaces Using Visual Studio 2010;363
20.9;Resolving Name Clashes via Explicit Interface Implementation
;364
20.10;Designing Interface Hierarchies;367
20.10.1;Multiple Inheritance with Interface Types;369
20.11;Building Enumerable Types (IEnumerable and IEnumerator);371
20.11.1;Building Iterator Methods with the yield Keyword;374
20.11.2;Building a Named Iterator;375
20.11.3;Internal Representation of an Iterator Method;376
20.12;Building Cloneable Objects (ICloneable);377
20.12.1;A More Elaborate Cloning Example;379
20.13;Building Comparable Objects (IComparable);382
20.13.1;Specifying Multiple Sort Orders (IComparer);385
20.13.2;Custom Properties, Custom Sort Types;386
20.14;Summary;387
21;CHAPTER 10 Understanding Generics
;388
21.1;The Issues with Non-Generic Collections;388
21.1.1;The Issue of Performance;390
21.1.2;The Issue of Type Safety;394
21.2;The Role of Generic Type Parameters;398
21.2.1;Specifying Type Parameters for Generic Classes / Structures;399
21.2.2;Specifying Type Parameters for Generic Members;401
21.2.3;Specifying Type Parameters for Generic Interfaces;401
21.3;The System.Collections.Generic Namespace;403
21.3.1;Understanding Collection Initialization Syntax;405
21.3.2;Working with the List Class;406
21.3.3;Working with the Stack Class;407
21.3.4;Working with the Queue Class;409
21.3.5;Working with the SortedSet Class;410
21.4;Creating Custom Generic Methods;412
21.4.1;Inference of Type Parameters;414
21.5;Creating Custom Generic Structures and Classes;415
21.5.1;The default Keyword in Generic Code;417
21.5.2;Generic Base Classes;418
21.6;Constraining Type Parameters;419
21.6.1;Examples Using the where Keyword;420
21.6.2;The Lack of Operator Constraints;421
21.7;Summary;422
22;CHAPTER 11 Delegates, Events, and Lambdas
;423
22.1;Understanding the .NET Delegate Type;423
22.2;Defining a Delegate Type in C#;424
22.3;The System.MulticastDelegate and System.Delegate Base Classes
;426
22.4;The Simplest Possible Delegate Example;428
22.4.1;Investigating a Delegate Object;430
22.5;Sending Object State Notifications using Delegates;431
22.5.1;Enabling Multicasting;434
22.5.2;Removing Targets from a Delegate’s Invocation List;436
22.6;Method Group Conversion Syntax;437
22.7;Understanding Delegate Covariance;439
22.8;Understanding Generic Delegates;441
22.8.1;Simulating Generic Delegates Without Generics;443
22.9;Understanding C# Events;444
22.9.1;The C# event Keyword;445
22.9.2;Events under the Hood;447
22.9.3;Listening to Incoming Events;448
22.9.4;Simplifying Event Registration Using Visual Studio 2010;449
22.9.5;Creating Custom Event Arguments;450
22.9.6;The Generic EventHandler Delegate;452
22.10;Understanding C# Anonymous Methods;453
22.10.1;Accessing Local Variables;455
22.11;Understanding Lambda Expressions;456
22.11.1;Dissecting a Lambda Expression;459
22.11.2;Processing Arguments Within Multiple Statements;459
22.11.3;Lambda Expressions with Multiple (or Zero) Parameters;461
22.11.4;Retrofitting the CarEvents Example Using Lambda Expressions;462
22.12;Summary;463
23;CHAPTER 12 Advanced C# Language Features
;464
23.1;Understanding Indexer Methods;464
23.1.1;Indexing Data Using String Values;466
23.1.2;Overloading Indexer Methods;468
23.1.3;Indexers with Multiple Dimensions;468
23.1.4;Indexer Definitions on Interface Types;469
23.2;Understanding Operator Overloading;469
23.2.1;Overloading Binary Operators;470
23.2.2;And What of the += and –+ Operators?;473
23.2.3;Overloading Unary Operators;473
23.2.4;Overloading Equality Operators;474
23.2.5;Overloading Comparison Operators;475
23.2.6;The Internal Representation of Overloaded Operators;476
23.2.7;Final Thoughts Regarding Operator Overloading;478
23.3;Understanding Custom Type Conversions;479
23.3.1;Recall: Numerical Conversions;479
23.3.2;Recall: Conversions Among Related Class Types;479
23.3.3;Creating Custom Conversion Routines;480
23.3.4;Additional Explicit Conversions for the Square Type;483
23.3.5;Defining Implicit Conversion Routines;483
23.3.6;The Internal Representation of Custom Conversion Routines;485
23.3.7;Understanding Extension Methods;485
23.3.7.1;Defining Extension Methods;486
23.3.7.2;Invoking Extension Methods on an Instance Level;488
23.3.7.3;Invoking Extension Methods Statically;489
23.3.7.4;The Scope of an Extension Method;489
23.3.7.5;Importing Types That Define Extension Methods;490
23.3.7.6;The IntelliSense of Extension Methods;491
23.3.7.7;Building and Using Extension Libraries;492
23.3.7.8;Extending Interface Types via Extension Methods;494
23.3.8;Understanding Partial Methods;495
23.3.8.1;A First Look at Partial Methods;496
23.3.8.2;Uses of Partial Methods;497
23.3.9;Understanding Anonymous Types;498
23.3.9.1;The Internal Representation of Anonymous Types;499
23.3.9.2;The Implementation of ToString() and GetHashCode();501
23.3.9.3;The Semantics of Equality for Anonymous Types;501
23.3.9.4;Anonymous Types Containing Anonymous Types;503
23.4;Working with Pointer Types;504
23.4.1;The unsafe Keyword;506
23.4.2;Working with the * and & Operators;507
23.4.3;An Unsafe (and Safe) Swap Function;508
23.4.4;Field Access via Pointers (the -> Operator);509
23.4.5;The stackalloc Keyword;510
23.4.6;Pinning a Type via the fixed Keyword;510
23.4.7;The sizeof Keyword;511
23.5;Summary;512
24;CHAPTER 13 LINQ to Objects
;513
24.1;LINQ Specific Programming Constructs;513
24.1.1;Implicit Typing of Local Variables;514
24.1.2;Object and Collection Initialization Syntax;515
24.1.3;Lambda Expressions;515
24.1.4;Extension Methods;516
24.1.5;Anonymous Types;517
24.2;Understanding the Role of LINQ;517
24.2.1;LINQ Expressions Are Strongly Typed;519
24.2.2;The Core LINQ Assemblies;519
24.3;Applying LINQ Queries to Primitive Arrays;520
24.3.1;Once Again, Without LINQ;521
24.3.2;Reflecting Over a LINQ Result Set;522
24.3.3;LINQ and Implicitly Typed Local Variables;522
24.3.4;LINQ and Extension Methods;524
24.3.5;The Role of Deferred Execution;525
24.3.6;The Role of Immediate Execution;526
24.4;Returning the Result of a LINQ Query;527
24.4.1;Returning LINQ Results via Immediate Execution;529
24.5;Applying LINQ Queries to Collection Objects;529
24.5.1;Accessing Contained Subobjects;530
24.5.2;Applying LINQ Queries to Nongeneric Collections;531
24.5.3;Filtering Data Using OfType();532
24.6;Investigating the C# LINQ Query Operators;532
24.6.1;Basic Selection Syntax;534
24.6.2;Obtaining Subsets of Data;535
24.6.3;Projecting New Data Types;536
24.6.4;Obtaining Counts Using Enumerable;537
24.6.5;Reversing Result Sets;538
24.6.6;Sorting Expressions;538
24.6.7;LINQ As a Better Venn Diagramming Tool;539
24.6.8;Removing Duplicates;540
24.6.9;LINQ Aggregation Operations;540
24.7;The Internal Representation of LINQ Query Statements;541
24.7.1;Building Query Expressions with Query Operators (Revisited);542
24.7.2;Building Query Expressions Using the Enumerable Type and Lambda Expressions
;543
24.7.3;Building Query Expressions Using the Enumerable Type and Anonymous Methods
;544
24.7.4;Building Query Expressions Using the Enumerable Type and Raw Delegates
;545
24.8;Summary;546
25;PART 4 Programming with .NET Assemblies
;547
26;CHAPTER 14 Configuring .NET Assemblies
;548
26.1;Defining Custom Namespaces;548
26.1.1;Resolving Name Clashes with Fully Qualified Names;550
26.1.2;Resolving Name Clashes with Aliases;551
26.1.3;Creating Nested Namespaces;553
26.1.4;The Default Namespace of Visual Studio 2010;554
26.2;The Role of .NET Assemblies;555
26.2.1;Assemblies Promote Code Reuse;555
26.2.2;Assemblies Establish a Type Boundary;555
26.2.3;Assemblies Are Versionable Units;555
26.2.4;Assemblies Are Self-Describing;556
26.2.5;Assemblies Are Configurable;556
26.3;Understanding the Format of a .NET Assembly;556
26.3.1;The Windows File Header;557
26.3.2;The CLR File Header;558
26.3.3;CIL Code, Type Metadata, and the Assembly Manifest;559
26.3.4;Optional Assembly Resources;559
26.3.5;Single-File and Multifile Assemblies;559
26.4;Building and Consuming a Single-File Assembly;561
26.4.1;Exploring the Manifest;564
26.4.2;Exploring the CIL;567
26.4.3;Exploring the Type Metadata;567
26.4.4;Building a C# Client Application;568
26.4.5;Building a Visual Basic Client Application;570
26.4.6;Cross-Language Inheritance in Action;572
26.5;Building and Consuming a Multifile Assembly;573
26.5.1;Exploring the ufo.netmodule File;574
26.5.2;Exploring the airvehicles.dll File;574
26.5.3;Consuming a Multifile Assembly;575
26.6;Understanding Private Assemblies;576
26.6.1;The Identity of a Private Assembly;576
26.6.2;Understanding the Probing Process;576
26.6.3;Configuring Private Assemblies;577
26.6.4;Configuration Files and Visual Studio 2010;579
26.7;Understanding Shared Assemblies;581
26.7.1;Understanding Strong Names;583
26.7.2;Generating Strong Names at the Command Line;584
26.7.3;Generating Strong Names using Visual Studio 2010;586
26.7.4;Installing Strongly Named Assemblies to the GAC;588
26.7.5;Viewing the .NET 4.0 GAC using Windows Explorer;589
26.8;Consuming a Shared Assembly;590
26.8.1;Exploring the Manifest of SharedCarLibClient;592
26.9;Configuring Shared Assemblies;592
26.9.1;Freezing the Current Shared Assembly;593
26.9.2;Building Shared Assembly Version 2.0.0.0;593
26.9.3;Dynamically Redirecting to Specific Versions of a Shared Assembly;596
26.10;Understanding Publisher Policy Assemblies;597
26.10.1;Disabling Publisher Policy;598
26.11;Understanding the Element;599
26.12;The System.Configuration Namespace;600
26.13;Summary;602
27;CHAPTER 15 Type Reflection, Late Binding, and Attribute-Based Programming
;603
27.1;The Necessity of Type Metadata;603
27.1.1;Viewing (Partial) Metadata for the EngineState Enumeration;604
27.1.2;Viewing (Partial) Metadata for the Car Type;605
27.1.3;Examining a TypeRef;607
27.1.4;Documenting the Defining Assembly;607
27.1.5;Documenting Referenced Assemblies;607
27.1.6;Documenting String Literals;608
27.2;Understanding Reflection;608
27.2.1;The System.Type Class;609
27.2.2;Obtaining a Type Reference Using System.Object.GetType();610
27.2.3;Obtaining a Type Reference Using typeof();611
27.2.4;Obtaining a Type Reference Using System.Type.GetType();611
27.3;Building a Custom Metadata Viewer;612
27.3.1;Reflecting on Methods;612
27.3.2;Reflecting on Fields and Properties;613
27.3.3;Reflecting on Implemented Interfaces;613
27.3.4;Displaying Various Odds and Ends;614
27.3.5;Implementing Main();614
27.3.6;Reflecting on Generic Types;616
27.3.7;Reflecting on Method Parameters and Return Values;616
27.4;Dynamically Loading Assemblies;618
27.5;Reflecting on Shared Assemblies;620
27.6;Understanding Late Binding;622
27.6.1;The System.Activator Class;623
27.6.2;Invoking Methods with No Parameters;624
27.6.3;Invoking Methods with Parameters;625
27.7;Understanding the Role of .NET Attributes;626
27.7.1;Attribute Consumers;627
27.7.2;Applying Attributes in C#;628
27.7.3;C# Attribute Shorthand Notation;629
27.7.4;Specifying Constructor Parameters for Attributes;630
27.7.5;The Obsolete Attribute in Action;630
27.8;Building Custom Attributes;631
27.8.1;Applying Custom Attributes;632
27.8.2;Named Property Syntax;632
27.8.3;Restricting Attribute Usage;633
27.9;Assembly-Level (and Module-Level) Attributes;634
27.9.1;The Visual Studio 2010 AssemblyInfo.cs File;635
27.10;Reflecting on Attributes Using Early Binding;636
27.11;Reflecting on Attributes Using Late Binding;637
27.12;Putting Reflection, Late Binding, and Custom Attributes in Perspective
;639
27.13;Building an Extendable Application;640
27.13.1;Building CommonSnappableTypes.dll;641
27.13.2;Building the C# Snap-In;641
27.13.3;Building the Visual Basic Snap-In;642
27.13.4;Building an Extendable Windows Forms Application;643
27.14;Summary;646
28;CHAPTER 16 Processes, AppDomains, and Object Contexts
;647
28.1;The Role of a Windows Process;647
28.1.1;The Role of Threads;648
28.2;Interacting with Processes Under the .NET Platform;649
28.2.1;Enumerating Running Processes;652
28.2.2;Investigating a Specific Process;653
28.2.3;Investigating a Process’s Thread Set;653
28.2.4;Investigating a Process’s Module Set;656
28.2.5;Starting and Stopping Processes Programmatically;657
28.2.6;Controlling Process Startup using the ProcessStartInfo Class;658
28.3;Understanding .NET Application Domains;659
28.3.1;The System.AppDomain Class;660
28.4;Interacting with the Default Application Domain;662
28.4.1;Enumerating Loaded Assemblies;663
28.4.2;Receiving Assembly Load Notifications;665
28.5;Creating New Application Domains;665
28.5.1;Loading Assemblies into Custom Application Domains;667
28.5.2;Programmatically Unloading AppDomains;668
28.6;Understanding Object Context Boundaries;670
28.6.1;Context-Agile and Context-Bound Types;671
28.6.2;Defining a Context-Bound Object;671
28.6.3;Inspecting an Object’s Context;672
28.7;Summarizing Processes, AppDomains, and Context;674
28.8;Summary;674
29;CHAPTER 17 Understanding CIL and the Role of Dynamic Assemblies
;675
29.1;Reasons for Learning the Grammar of CIL;675
29.2;Examining CIL Directives, Attributes, and Opcodes;676
29.2.1;The Role of CIL Directives;677
29.2.2;The Role of CIL Attributes;677
29.2.3;The Role of CIL Opcodes;677
29.2.4;The CIL Opcode/CIL Mnemonic Distinction;677
29.3;Pushing and Popping: The Stack-Based Nature of CIL;678
29.4;Understanding Round-Trip Engineering;680
29.4.1;The Role of CIL Code Labels;683
29.4.2;Interacting with CIL: Modifying an *.il File;684
29.4.3;Compiling CIL Code Using ilasm.exe;685
29.4.4;Authoring CIL Code Using SharpDevelop;687
29.4.5;The Role of peverify.exe;688
29.5;Understanding CIL Directives and Attributes;688
29.5.1;Specifying Externally Referenced Assemblies in CIL;688
29.5.2;Defining the Current Assembly in CIL;689
29.5.3;Defining Namespaces in CIL;690
29.5.4;Defining Class Types in CIL;690
29.5.5;Defining and Implementing Interfaces in CIL;692
29.5.6;Defining Structures in CIL;692
29.5.7;Defining Enums in CIL;693
29.5.8;Defining Generics in CIL;693
29.5.9;Compiling the CILTypes.il file;694
29.6;.NET Base Class Library, C#, and CIL Data Type Mappings;695
29.7;Defining Type Members in CIL;696
29.7.1;Defining Field Data in CIL;696
29.7.2;Defining Type Constructors in CIL;697
29.7.3;Defining Properties in CIL;698
29.7.4;Defining Member Parameters;698
29.8;Examining CIL Opcodes;699
29.8.1;The .maxstack Directive;702
29.8.2;Declaring Local Variables in CIL;702
29.8.3;Mapping Parameters to Local Variables in CIL;703
29.8.4;The Hidden this Reference;704
29.8.5;Representing Iteration Constructs in CIL;704
29.9;Building a .NET Assembly with CIL;705
29.9.1;Building CILCars.dll;705
29.9.2;Building CILCarClient.exe;708
29.10;Understanding Dynamic Assemblies;710
29.10.1;Exploring the System.Reflection.Emit Namespace;711
29.10.2;The Role of the System.Reflection.Emit.ILGenerator;712
29.10.3;Emitting a Dynamic Assembly;713
29.10.4;Emitting the Assembly and Module Set;715
29.10.5;The Role of the ModuleBuilder Type;716
29.10.6;Emitting the HelloClass Type and the String Member Variable;717
29.10.7;Emitting the Constructors;718
29.10.8;Emitting the SayHello() Method;719
29.10.9;Using the Dynamically Generated Assembly;719
29.11;Summary;720
30;CHAPTER 18 Dynamic Types and the Dynamic Language Runtime
;722
30.1;The Role of the C# dynamic Keyword;722
30.1.1;Calling Members on Dynamically Declared Data;724
30.1.2;The Role of the Microsoft.CSharp.dll Assembly;726
30.1.3;The Scope of the dynamic keyword;727
30.1.4;Limitations of the dynamic Keyword;727
30.1.5;Practical Uses of the dynamic Keyword;728
30.2;The Role of the Dynamic Language Runtime (DLR);728
30.2.1;The Role of Expression Trees;729
30.2.2;The Role of the System.Dynamic Namespace;730
30.2.3;Dynamic Runtime Lookup of Expression Trees;730
30.3;Simplifying Late Bound Calls Using Dynamic Types;731
30.3.1;Leveraging the dynamic Keyword to Pass Arguments;732
30.4;Simplifying COM Interoperability using Dynamic Data;735
30.4.1;The Role of Primary Interop Assemblies (PIAs);736
30.4.2;Embedding Interop Metadata;737
30.4.3;Common COM Interop Pain Points;738
30.5;COM Interop using C# 4.0 Language Features;739
30.5.1;COM interop without C# 4.0 Language Features;743
30.6;Summary;744
31;PART 5 Introducing the .NET Base Class Libraries
;746
32;CHAPTER 19 Multithreaded and Parallel Programming
;747
32.1;The Process/AppDomain/Context/Thread Relationship;747
32.1.1;The Problem of Concurrency;748
32.1.2;The Role of Thread Synchronization;749
32.2;A Brief Review of the .NET Delegate;749
32.3;The Asynchronous Nature of Delegates;751
32.3.1;The BeginInvoke() and EndInvoke() Methods;752
32.3.2;The System.IAsyncResult Interface;752
32.4;Invoking a Method Asynchronously;753
32.4.1;Synchronizing the Calling Thread;754
32.4.2;The Role of the AsyncCallback Delegate;756
32.4.3;The Role of the AsyncResult Class;758
32.4.4;Passing and Receiving Custom State Data;758
32.5;The System.Threading Namespace;759
32.6;The System.Threading.Thread Class;761
32.6.1;Obtaining Statistics About the Current Thread;762
32.6.2;The Name Property;763
32.6.3;The Priority Property;764
32.7;Programmatically Creating Secondary Threads;764
32.7.1;Working with the ThreadStart Delegate;765
32.7.2;Working with the ParameterizedThreadStart Delegate;767
32.7.3;The AutoResetEvent Class;768
32.7.4;Foreground Threads and Background Threads;769
32.8;The Issue of Concurrency;770
32.8.1;Synchronization Using the C# lock Keyword;773
32.8.2;Synchronization Using the System.Threading.Monitor Type;775
32.8.3;Synchronization Using the System.Threading.Interlocked Type;776
32.8.4;Synchronization Using the [Synchronization] Attribute;777
32.9;Programming with Timer Callbacks;778
32.10;Understanding the CLR ThreadPool;780
32.11;Parallel Programming under the .NET Platform;781
32.11.1;The Task Parallel Library API;782
32.11.2;The Role of the Parallel Class;783
32.11.3;Understanding Data Parallelism;783
32.11.4;The Task Class;785
32.11.5;Handling Cancelation Request;786
32.11.6;Understanding Task Parallelism;788
32.12;Parallel LINQ Queries (PLINQ);791
32.12.1;Opting in to a PLINQ Query;792
32.12.2;Canceling a PLINQ Query;792
32.13;Summary;794
33;CHAPTER 20 File I/O and Object Serialization
;795
33.1;Exploring the System.IO Namespace;795
33.2;The Directory(Info) and File(Info) Types;797
33.2.1;The Abstract FileSystemInfo Base Class;797
33.3;Working with the DirectoryInfo Type;798
33.3.1;Enumerating Files with the DirectoryInfo Type;800
33.3.2;Creating Subdirectories with the DirectoryInfo Type;801
33.4;Working with the Directory Type;802
33.5;Working with the DriveInfo Class Type;803
33.6;Working with the FileInfo Class;805
33.6.1;The FileInfo.Create() Method;806
33.6.2;The FileInfo.Open() Method;806
33.6.3;The FileInfo.OpenRead() and FileInfo.OpenWrite() Methods;808
33.6.4;The FileInfo.OpenText() Method;809
33.6.5;The FileInfo.CreateText() and FileInfo.AppendText() Methods;809
33.7;Working with the File Type;809
33.7.1;Additional File-centric Members;810
33.8;The Abstract Stream Class;812
33.8.1;Working with FileStreams;813
33.9;Working with StreamWriters and StreamReaders;814
33.9.1;Writing to a Text File;815
33.9.2;Reading from a Text File;816
33.9.3;Directly Creating StreamWriter/StreamReader Types;817
33.10;Working with StringWriters and StringReaders;818
33.11;Working with BinaryWriters and BinaryReaders;819
33.12;Watching Files Programmatically;821
33.13;Understanding Object Serialization;824
33.13.1;The Role of Object Graphs;825
33.14;Configuring Objects for Serialization;826
33.14.1;Defining Serializable Types;827
33.14.2;Public Fields, Private Fields, and Public Properties;827
33.15;Choosing a Serialization Formatter;828
33.15.1;The IFormatter and IRemotingFormatter Interfaces;829
33.15.2;Type Fidelity Among the Formatters;830
33.16;Serializing Objects Using the BinaryFormatter;831
33.16.1;Deserializing Objects Using the BinaryFormatter;832
33.17;Serializing Objects Using the SoapFormatter;833
33.18;Serializing Objects Using the XmlSerializer;834
33.18.1;Controlling the Generated XML Data;835
33.19;Serializing Collections of Objects;836
33.20;Customizing the Soap/Binary Serialization Process;838
33.20.1;A Deeper Look at Object Serialization;839
33.20.2;Customizing Serialization Using ISerializable;840
33.20.3;Customizing Serialization Using Attributes;843
33.21;Summary;844
34;CHAPTER 21 ADO.NET Part I: The Connected Layer
;845
34.1;A High-Level Definition of ADO.NET;845
34.1.1;The Three Faces of ADO.NET;846
34.2;Understanding ADO.NET Data Providers;847
34.2.1;The Microsoft-Supplied ADO.NET Data Providers;849
34.2.2;A Word Regarding System.Data.OracleClient.dll;850
34.2.3;Obtaining Third-Party ADO.NET Data Providers;851
34.3;Additional ADO.NET Namespaces;851
34.4;The Types of the System.Data Namespace;852
34.4.1;The Role of the IDbConnection Interface;853
34.4.2;The Role of the IDbTransaction Interface;854
34.4.3;The Role of the IDbCommand Interface;854
34.4.4;The Role of the IDbDataParameter and IDataParameter Interfaces;854
34.4.5;The Role of the IDbDataAdapter and IDataAdapter Interfaces;855
34.4.6;The Role of the IDataReader and IDataRecord Interfaces;856
34.5;Abstracting Data Providers Using Interfaces;857
34.5.1;Increasing Flexibility Using Application Configuration Files;859
34.6;Creating the AutoLot Database;860
34.6.1;Creating the Inventory Table;860
34.6.2;Authoring the GetPetName() Stored Procedure;863
34.6.3;Creating the Customers and Orders Tables;864
34.6.4;Visually Creating Table Relationships;866
34.7;The ADO.NET Data Provider Factory Model;867
34.7.1;A Complete Data Provider Factory Example;868
34.7.2;A Potential Drawback with the Provide Factory Model;871
34.7.3;The Element;872
34.8;Understanding the Connected Layer of ADO.NET;873
34.8.1;Working with Connection Objects;874
34.8.2;Working with ConnectionStringBuilder Objects;876
34.8.3;Working with Command Objects;878
34.9;Working with Data Readers;879
34.9.1;Obtaining Multiple Result Sets Using a Data Reader;881
34.10;Building a Reusable Data Access Library;881
34.10.1;Adding the Connection Logic;883
34.10.2;Adding the Insertion Logic;883
34.10.3;Adding the Deletion Logic;885
34.10.4;Adding the Update Logic;885
34.10.5;Adding the Selection Logic;886
34.10.6;Working with Parameterized Command Objects;887
34.10.6.1;Specifying Parameters Using the DbParameter Type;887
34.10.7;Executing a Stored Procedure;889
34.11;Creating a Console UI–Based Front End;891
34.11.1;Implementing the Main() Method;892
34.11.2;Implementing the ShowInstructions() Method;893
34.11.3;Implementing the ListInventory() Method;894
34.11.4;Implementing the DeleteCar() Method;895
34.11.5;Implementing the InsertNewCar() Method;895
34.11.6;Implementing the UpdateCarPetName() Method;896
34.11.7;Implementing LookUpPetName();896
34.12;Understanding Database Transactions;897
34.12.1;Key Members of an ADO.NET Transaction Object;898
34.12.2;Adding a CreditRisks Table to the AutoLot Database;899
34.12.3;Adding a Transaction Method to InventoryDAL;900
34.12.4;Testing Your Database Transaction;902
34.13;Summary;903
35;CHAPTER 22 ADO.NET Part II: The Disconnected Layer
;904
35.1;Understanding the Disconnected Layer of ADO.NET;904
35.2;Understanding the Role of the DataSet;905
35.2.1;Key Properties of the DataSet;906
35.2.2;Key Methods of the DataSet;907
35.2.3;Building a DataSet;908
35.3;Working with DataColumns;908
35.3.1;Building a DataColumn;910
35.3.2;Enabling Autoincrementing Fields;911
35.3.3;Adding DataColumn Objects to a DataTable;911
35.4;Working with DataRows;912
35.4.1;Understanding the RowState Property;913
35.4.2;Understanding the DataRowVersion Property;915
35.5;Working with DataTables;916
35.5.1;Inserting DataTables into DataSets;917
35.5.2;Obtaining Data in a DataSet;917
35.5.3;Processing DataTable Data Using DataTableReader Objects;918
35.5.4;Serializing DataTable/DataSet Objects As XML;920
35.5.5;Serializing DataTable/DataSet Objects in a Binary Format;921
35.6;Binding DataTable Objects to Windows Forms GUIs;922
35.6.1;Hydrating a DataTable from a Generic List;923
35.6.2;Deleting Rows from a DataTable;926
35.6.3;Selecting Rows Based on Filter Criteria;927
35.6.4;Updating Rows Within a DataTable;930
35.6.5;Working with the DataView Type;931
35.7;Working with Data Adapters;932
35.7.1;A Simple Data Adapter Example;933
35.7.2;Mapping Database Names to Friendly Names;935
35.8;Adding Disconnection Functionality to AutoLotDAL.dll;936
35.8.1;Defining the Initial Class Type;936
35.8.2;Configuring the Data Adapter Using the SqlCommandBuilder;937
35.8.3;Implementing GetAllInventory();938
35.8.4;Implementing UpdateInventory();938
35.8.5;Setting Your Version Number;938
35.8.6;Testing the Disconnected Functionality;939
35.9;Multitabled DataSet Objects and Data Relationships;940
35.9.1;Prepping the Data Adapters;941
35.9.2;Building the Table Relationships;943
35.9.3;Updating the Database Tables;943
35.9.4;Navigating Between Related Tables;944
35.10;The Windows Forms Database Designer Tools;946
35.10.1;Visually Designing the DataGridView;946
35.10.2;The Generated app.config File;951
35.10.3;Examining the Strongly Typed DataSet;951
35.10.4;Examining the Strongly Typed DataTable;953
35.10.5;Examining the Strongly Typed DataRow;954
35.10.6;Examining the Strongly Typed Data Adapter;955
35.10.7;Completing the Windows Forms Application;956
35.11;Isolating Strongly Typed Database Code into a Class Library;957
35.11.1;Viewing the Generated Code;958
35.11.2;Selecting Data with the Generated Code;959
35.11.3;Inserting Data with the Generated Code;960
35.11.4;Deleting Data with the Generated Code;961
35.11.5;Invoking a Stored Procedure using the Generated Code;962
35.12;Programming with LINQ to DataSet;962
35.12.1;The Role of the DataSet Extensions Library;964
35.12.2;Obtaining a LINQ-Compatible DataTable;965
35.12.3;The Role of the DataRowExtensions.Field() Extension Method;967
35.12.4;Hydrating New DataTables from LINQ Queries;967
35.13;Summary;968
36;CHAPTER 23 ADO.NET Part III: The Entity Framework
;970
36.1;Understanding the Role of Entity Framework;970
36.1.1;The Role of Entities;972
36.1.2;The Building Blocks of the Entity Framework;974
36.1.2.1;The Role of Object Services;975
36.1.2.2;The Role of the Entity Client;975
36.1.2.3;The Role of the *.edmx File (and Friends);977
36.1.2.4;The Role of the ObjectContext and ObjectSet Classes;977
36.1.2.5;All Together Now!;979
36.2;Building and Analyzing your First EDM;980
36.2.1;Generating the *.edmx File;980
36.2.2;Reshaping the Entity Data;984
36.2.3;Viewing the Mappings;986
36.2.4;Viewing the Generated *.edmx File Data;987
36.2.5;Viewing the Generated Source Code;989
36.2.6;Enhancing the Generated Source Code;991
36.3;Programming Against the Conceptual Model;992
36.3.1;Deleting a Record;993
36.3.2;Updating a Record;994
36.3.3;Querying with LINQ to Entities;994
36.3.4;Querying with Entity SQL;996
36.3.5;Working with the Entity Client Data Reader Object;997
36.4;AutoLotDAL Version 4.0, Now with Entities;998
36.4.1;Mapping the Stored Procedure;999
36.4.2;The Role of Navigation Properties;1001
36.4.3;Using Navigation Properties within LINQ to Entity Queries;1003
36.4.4;Invoking a Stored Procedure;1004
36.5;Data Binding Entities to Windows Forms GUIs;1005
36.5.1;Adding the Data Binding Code;1008
36.6;Summary;1010
37;CHAPTER 24 Introducing LINQ to XML
;1011
37.1;A Tale of Two XML APIs;1011
37.1.1;LINQ to XML As a Better DOM;1013
37.1.2;VB Literal Syntax As a Better LINQ to XML;1014
37.2;Members of the System.Xml.Linq Namespace;1015
37.2.1;The LINQ to XML Axis Methods;1018
37.2.2;The Oddness of XName (and XNamespace);1019
37.3;Working with XElement and XDocument;1020
37.3.1;Generating Documents from Arrays and Containers;1022
37.3.2;Loading and Parsing XML Content;1024
37.4;Manipulating an in Memory XML Document;1024
37.4.1;Building the UI of the LINQ to XML App;1025
37.4.2;Import the Inventory.xml File;1025
37.4.3;Defining a LINQ to XML Helper Class;1026
37.4.4;Rigging up the UI to Your Helper Class;1027
37.5;Summary;1029
38;CHAPTER 25 Introducing Windows Communication Foundation
;1030
38.1;A Potpourri of Distributed Computing APIs;1030
38.1.1;The Role of DCOM;1031
38.1.2;The Role of COM+/Enterprise Services;1032
38.1.3;The Role of MSMQ;1032
38.1.4;The Role of .NET Remoting;1033
38.1.5;The Role of XML Web Services;1033
38.1.5.1;A .NET Web Service Example;1034
38.1.5.2;Web Service Standards;1036
38.1.6;Named Pipes, Sockets, and P2P;1036
38.2;The Role of WCF;1036
38.2.1;An Overview of WCF Features;1037
38.2.2;An Overview of Service-Oriented Architecture;1038
38.2.2.1;Tenet 1: Boundaries Are Explicit;1038
38.2.2.2;Tenet 2: Services Are Autonomous;1038
38.2.2.3;Tenet 3: Services Communicate via Contract, Not Implementation;1038
38.2.2.4;Tenet 4: Service Compatibility Is Based on Policy;1038
38.2.3;WCF: The Bottom Line;1039
38.3;Investigating the Core WCF Assemblies;1039
38.4;The Visual Studio WCF Project Templates;1040
38.4.1;The WCF Service Website Project Template;1042
38.5;The Basic Composition of a WCF Application;1042
38.6;The ABCs of WCF;1044
38.6.1;Understanding WCF Contracts;1044
38.6.2;Understanding WCF Bindings;1045
38.6.2.1;HTTP-Based Bindings;1046
38.6.2.2;TCP-Based Bindings;1047
38.6.2.3;MSMQ-Based Bindings;1048
38.6.3;Understanding WCF Addresses;1048
38.7;Building a WCF Service;1049
38.7.1;The [ServiceContract] Attribute;1051
38.7.2;The [OperationContract] Attribute;1052
38.7.3;Service Types As Operational Contracts;1052
38.8;Hosting the WCF Service;1053
38.8.1;Establishing the ABCs Within an App.config File;1054
38.8.2;Coding Against the ServiceHost Type;1055
38.8.3;Specifying Base Addresses;1055
38.8.4;Details of the ServiceHost Type;1057
38.8.5;Details of the Element;1059
38.8.6;Enabling Metadata Exchange;1060
38.9;Building the WCF Client Application;1063
38.9.1;Generating Proxy Code Using svcutil.exe;1063
38.9.2;Generating Proxy Code Using Visual Studio 2010;1064
38.9.3;Configuring a TCP-Based Binding;1066
38.10;Simplifying Configuration Settings with WCF 4.0;1067
38.10.1;Default Endpoints in WCF 4.0;1068
38.10.2;Exposing a Single WCF Service Using Multiple Bindings;1069
38.10.3;Changing Settings for a WCF Binding;1070
38.10.4;The WCF 4.0 Default MEX Behavior Configuration;1071
38.10.5;Refreshing the Client Proxy and Selecting the Binding;1073
38.11;Using the WCF Service Library Project Template;1074
38.11.1;Building a Simple Math Service;1074
38.11.2;Testing the WCF Service with WcfTestClient.exe;1075
38.11.3;Altering Configuration Files Using SvcConfigEditor.exe;1076
38.12;Hosting the WCF Service within a Windows Service;1078
38.12.1;Specifying the ABCs in Code;1079
38.12.2;Enabling MEX;1081
38.12.3;Creating a Windows Service Installer;1081
38.12.4;Installing the Windows Service;1083
38.13;Invoking a Service Asynchronously from the Client;1084
38.14;Designing WCF Data Contracts;1087
38.14.1;Using the Web-Centric WCF Service Project Template;1088
38.14.2;Implementing the Service Contract;1090
38.14.3;The Role of the *.svc File;1091
38.14.4;Examining the Web.config File;1092
38.14.5;Testing the Service;1092
38.15;Summary;1093
39;CHAPTER 26 Introducing Windows Workflow Foundation 4.0
;1094
39.1;Defining a Business Process;1095
39.1.1;The Role of WF 4.0;1095
39.2;Building a (Painfully) Simple Workflow;1096
39.2.1;Viewing the Underlying XAML;1098
39.3;The WF 4.0 Runtime;1100
39.3.1;Hosting a Workflow using WorkflowInvoker;1100
39.3.1.1;Passing Arguments to your Workflow using WorkflowInvoker;1101
39.3.1.2;Defining Arguments using the Workflow Designer;1101
39.3.2;Hosting a Workflow using WorkflowApplication;1103
39.3.3;Recap of your First Workflow;1105
39.4;Examining the Workflow 4.0 Activities;1105
39.4.1;Control Flow Activities;1106
39.4.2;Flowchart Activities;1106
39.4.3;Messaging Activities;1107
39.4.4;The Runtime and Primitives Activities;1108
39.4.5;The Transaction Activities;1108
39.4.6;The Collection and Error Handling Activities;1109
39.5;Building a Flowchart Workflow;1110
39.5.1;Connecting Activities in a Flowchart;1111
39.5.2;Working with the InvokeMethod Activity;1111
39.5.3;Defining Workflow Wide Variables;1112
39.5.4;Working with the FlowDecision Activity;1113
39.5.5;Working with the TerminateWorkflow Activity;1114
39.5.6;Building the “True” Condition;1115
39.5.7;Working with the ForEach Activity;1116
39.5.8;Completing the Application;1117
39.5.9;Reflecting on What We Have Done;1118
39.6;Isolating Workflows into Dedicated Libraries;1120
39.6.1;Defining the Initial Project;1120
39.6.2;Importing Assemblies and Namespaces;1122
39.6.3;Defining the Workflow Arguments;1122
39.6.4;Defining Workflow Variables;1123
39.6.5;Working with the Assign Activity;1124
39.6.6;Working with the If and Switch Activities;1124
39.6.7;Building a Custom Code Activity;1126
39.7;Consuming the Workflow Library;1129
39.7.1;Retrieving the Workflow Output Argument;1130
39.8;Summary;1131
40;PART 6 Building Desktop User Interfaces with WPF
;1132
41;CHAPTER 27 Introducing Windows Presentation Foundation and XAML
;1133
41.1;The Motivation Behind WPF;1133
41.1.1;Unifying Diverse APIs;1134
41.1.2;Providing a Separation of Concerns via XAML;1135
41.1.3;Providing an Optimized Rendering Model;1136
41.1.4;Simplifying Complex UI Programming;1136
41.2;The Various Flavors of WPF;1137
41.2.1;Traditional Desktop Applications;1137
41.2.2;Navigation-Based WPF Applications;1140
41.2.3;XBAP Applications;1140
41.2.4;The WPF/Silverlight Relationship;1142
41.3;Investigating the WPF Assemblies;1142
41.3.1;The Role of the Application Class;1144
41.3.1.1;Constructing an Application Class;1145
41.3.1.2;Enumerating the Application.Windows collection;1146
41.3.2;The Role of the Window Class;1146
41.3.2.1;The Role of System.Windows.Controls.ContentControl;1147
41.3.2.2;The Role of System.Windows.Controls.Control;1148
41.3.2.3;The Role of System.Windows.FrameworkElement;1149
41.3.2.4;The Role of System.Windows.UIElement;1150
41.3.2.5;The Role of System.Windows.Media.Visual;1150
41.3.2.6;The Role of System.Windows.DependencyObject;1151
41.3.2.7;The Role of System.Windows.Threading.DispatcherObject;1151
41.4;Building a WPF Application without XAML;1151
41.4.1;Creating a Strongly Typed Window;1153
41.4.2;Creating a Simple User Interface;1154
41.4.3;Interacting with Application Level Data;1155
41.4.4;Handling the Closing of a Window Object;1157
41.4.5;Intercepting Mouse Events;1158
41.4.6;Intercepting Keyboard Events;1159
41.5;Building a WPF Application using Only XAML;1160
41.5.1;Defining MainWindow in XAML;1162
41.5.2;Defining the Application Object in XAML;1163
41.5.3;Processing the XAML Files using msbuild.exe;1164
41.6;Transforming Markup into a .NET Assembly;1166
41.6.1;Mapping the Window XAML Data to C# Code;1166
41.6.2;The Role of BAML;1167
41.6.3;Mapping the Application XAML Data to C# Code;1169
41.6.4;XAML-to-Assembly Process Summary;1169
41.7;Understanding The Syntax of WPF XAML;1170
41.7.1;Introducing Kaxaml;1170
41.7.2;XAML XML Namespaces and XAML "Keywords";1172
41.7.3;Controlling Class and Member Variable Declarations;1175
41.7.4;XAML Elements, XAML Attributes and Type Converters;1176
41.7.5;Understanding XAML Property-Element Syntax;1177
41.7.6;Understanding XAML Attached Properties;1178
41.7.7;Understanding XAML Markup Extensions;1179
41.8;Building a WPF Application using Code-Behind Files;1181
41.8.1;Adding a Code File for the MainWindow Class;1181
41.8.2;Adding a Code File for the MyApp Class;1182
41.8.3;Processing the Code Files with msbuild.exe;1182
41.9;Building WPF Applications Using Visual Studio 2010;1183
41.9.1;The WPF Project Templates;1184
41.9.2;Exploring the WPF Designer Tools;1185
41.9.3;Designing the GUI of our Window;1189
41.9.4;Implementing the Loaded Event;1190
41.9.5;Implementing the Button’s Click Event;1191
41.9.6;Implementing the Closed Event;1193
41.9.7;Testing the Application;1193
41.10;Summary;1194
42;CHAPTER 28 Programming with WPF Controls
;1195
42.1;A Survey of the Core WPF Controls;1195
42.1.1;Working with WPF Controls Using Visual Studio 2010;1197
42.1.2;The WPF Ink Controls;1198
42.1.3;The WPF Document Controls;1199
42.1.4;WPF Common Dialog Boxes;1199
42.1.5;The Details Are in the Documentation;1200
42.2;Controlling Content Layout Using Panels;1200
42.2.1;Positioning Content Within Canvas Panels;1202
42.2.2;Positioning Content Within WrapPanel Panels;1204
42.2.3;Positioning Content Within StackPanel Panels;1206
42.2.4;Positioning Content Within Grid Panels;1207
42.2.4.1;Grids with GridSplitter Types;1208
42.2.5;Positioning Content Within DockPanel Panels;1209
42.2.6;Enabling Scrolling for Panel Types;1210
42.3;Building a Window’s Frame Using Nested Panels;1211
42.3.1;Building the Menu System;1212
42.3.2;Building the ToolBar;1213
42.3.3;Building the StatusBar;1214
42.3.4;Finalizing the UI Design;1214
42.3.5;Implementing the MouseEnter/MouseLeave Event Handlers;1215
42.3.6;Implementing the Spell Checking Logic;1216
42.4;Understanding WPF Control Commands;1216
42.4.1;The Intrinsic Control Command Objects;1217
42.4.2;Connecting Commands to the Command Property;1218
42.4.3;Connecting Commands to Arbitrary Actions;1219
42.4.4;Working with the Open and Save Commands;1220
42.5;Building a WPF User Interface with Expression Blend;1223
42.5.1;Getting to know the Key Aspects of the Blend IDE;1223
42.5.2;Using the TabControl;1229
42.6;Building the Ink API Tab;1232
42.6.1;Designing the ToolBar;1233
42.6.2;The RadioButton Control;1236
42.6.3;The InkCanvas Control;1238
42.6.4;The ComboBox Control;1240
42.6.5;Saving, Loading, and Clearing InkCanvas Data;1242
42.7;Introducing the Documents API;1243
42.7.1;Block Elements and Inline Elements;1243
42.7.2;Document Layout Managers;1244
42.8;Building the Documents Tab;1244
42.8.1;Populating a FlowDocument using Blend;1246
42.8.2;Populating a FlowDocument Using Code;1247
42.8.3;Enabling Annotations and Sticky Notes;1248
42.8.4;Saving and Loading a Flow Document;1250
42.9;Introducing the WPF Data-Binding Model;1251
42.9.1;Building the Data Binding Tab;1252
42.9.2;Establishing Data Bindings using Blend;1252
42.9.3;The DataContext Property;1255
42.9.4;Data Conversion Using IValueConverter;1256
42.9.5;Establishing Data Bindings in Code;1257
42.9.6;Building the DataGrid Tab;1258
42.10;Summary;1260
43;CHAPTER 29 WPF Graphics Rendering Services
;1261
43.1;Understanding WPF's Graphical Rendering Services;1261
43.1.1;WPF Graphical Rendering Options;1262
43.2;Rendering Graphical Data Using Shapes;1263
43.2.1;Adding Rectangles, Ellipses, and Lines to a Canvas;1265
43.2.2;Removing Rectangles, Ellipses, and Lines from a Canvas;1268
43.2.3;Working with Polylines and Polygons;1269
43.2.4;Working with Paths;1270
43.2.4.1;The Path "Modeling Mini Language";1272
43.3;WPF Brushes and Pens;1273
43.3.1;Configuring Brushes Using Visual Studio 2010;1274
43.3.2;Configuring Brushes in Code;1276
43.3.3;Configuring Pens;1277
43.4;Applying Graphical Transformations;1278
43.4.1;A First Look at Transformations;1279
43.4.2;Transforming our Canvas Data;1280
43.5;Working with Shapes using Expression Blend;1282
43.5.1;Selecting a Shape to Render from the Tool Palette;1282
43.5.2;Converting Shapes to Paths;1283
43.5.3;Combining Shapes;1284
43.5.4;The Brush and Transformation Editors;1285
43.6;Rendering Graphical Data Using Drawings and Geometries;1287
43.6.1;Building a DrawingBrush using Geometries;1288
43.6.2;Painting with the DrawingBrush;1289
43.6.3;Containing Drawing Types in a DrawingImage;1290
43.7;Generating Complex Vector Graphics using Expression Design
;1291
43.7.1;Exporting a Design Document to XAML;1291
43.8;Rendering Graphical Data Using the Visual Layer;1293
43.8.1;The Visual Base Class and Derived Child Classes;1293
43.8.2;A First Look at using the DrawingVisual Class;1294
43.8.3;Rendering Visual Data to a Custom Layout Manager;1296
43.8.4;Responding to Hit Test Operations;1298
43.9;Summary;1300
44;CHAPTER 30 WPF Resources, Animations, and Styles
;1301
44.1;Understanding the WPF Resource System;1301
44.1.1;Working with Binary Resources;1301
44.1.1.1;Including Loose Resource Files in a Project;1302
44.1.1.2;Configuring the Loose Resources;1303
44.1.1.3;Programmatically Loading an Image;1304
44.1.1.4;Embedding Application Resources;1305
44.2;Working with Object (Logical) Resources;1308
44.2.1;The Role of the Resources Property;1308
44.2.2;Defining Window-Wide Resources;1308
44.2.3;The {StaticResource} Markup Extension;1310
44.2.4;Changing a Resource after Extraction;1311
44.2.5;The {DynamicResource} Markup Extension;1311
44.2.6;Application-Level Resources;1312
44.2.7;Defining Merged Resource Dictionaries;1314
44.2.8;Defining a Resource-Only Assembly;1316
44.2.9;Extracting Resources in Expression Blend;1317
44.3;Understanding WPF’s Animation Services;1319
44.3.1;The Role of the Animation Class Types;1320
44.3.2;The To, From, and By Properties;1321
44.3.3;The Role of the Timeline Base Class;1321
44.3.4;Authoring an Animation in C# Code;1322
44.3.5;Controlling the Pacing of an Animation;1323
44.3.6;Reversing and Looping an Animation;1324
44.4;Authoring Animations in XAML;1325
44.4.1;The Role of Storyboards;1326
44.4.2;The Role of Event Triggers;1326
44.4.3;Animation Using Discrete Key Frames;1327
44.5;Understanding the Role of WPF Styles;1328
44.5.1;Defining and Applying a Style;1329
44.5.2;Overriding Style Settings;1330
44.5.3;Automatically Applying a Style with TargetType;1330
44.5.4;Subclassing Existing Styles;1331
44.5.5;The Role of Unnamed Styles;1332
44.5.6;Defining Styles with Triggers;1333
44.5.7;Defining Styles with Multiple Triggers;1333
44.5.8;Animated Styles;1334
44.5.9;Assigning Styles Programmatically;1335
44.6;Generating Styles with Expression Blend;1336
44.6.1;Working with Default Visual Styles;1336
44.7;Summary;1340
45;CHAPTER 31 WPF Control Templates and User Controls ;1341
45.1;Understanding the Role of Dependency Properties;1341
45.1.1;Examining an Existing Dependency Property;1343
45.1.2;Important Notes Regarding CLR Property Wrappers;1346
45.2;Building a Custom Dependency Property;1347
45.2.1;Adding a Data Validation Routine;1351
45.2.2;Responding to the Property Change;1351
45.3;Understanding Routed Events;1353
45.3.1;The Role of Routed Bubbling Events;1354
45.3.2;Continuing or Halting Bubbling;1355
45.3.3;The Role of Routed Tunneling Events;1355
45.4;Logical Trees, Visual Trees and Default Templates;1357
45.4.1;Programmatically Inspecting a Logical Tree;1358
45.4.2;Programmatically Inspecting a Visual Tree;1359
45.4.3;Programmatically Inspecting a Control’s Default Template;1360
45.5;Building a Custom Control Template with Visual Studio 2010;1364
45.5.1;Templates as Resources;1365
45.5.2;Incorporating Visual Cues using Triggers;1367
45.5.3;The Role of {TemplateBinding} Markup Extension;1368
45.5.4;The Role of ContentPresenter;1370
45.5.5;Incorporating Templates into Styles;1370
45.6;Building Custom UserControls with Blend;1372
45.6.1;Creating a UserControl Library Project;1372
45.6.1.1;Renaming the Initial UserControl;1373
45.6.1.2;Designing the SpinControl;1374
45.6.1.3;Adding the Initial C# Code;1375
45.6.1.4;Defining an Animation using Blend;1375
45.6.1.5;Programmatically Starting our Storyboard;1379
45.7;Creating the Jackpot Deluxe WPF Application;1380
45.7.1;Extracting a UserControl from a Drawing Geometry;1381
45.7.2;The Role of .NET 4.0 Visual States;1382
45.7.2.1;Defining Visual States for the StarButton Control;1383
45.7.2.2;Defining State Transition Timings;1384
45.7.2.3;Viewing the Generated XAML;1385
45.7.2.4;Changing Visual States in Code using the VisualStateManager Class;1386
45.7.3;Finalizing the Jackpot Deluxe Application;1387
45.8;Summary;1391
46;PART 7 Building Web Applications with ASP .NET
;1392
47;CHAPTER 32 Building ASP.NET Web Pages
;1393
47.1;The Role of HTTP;1393
47.1.1;The HTTP Request/Response Cycle;1394
47.1.2;HTTP Is a Stateless Protocol;1394
47.2;Understanding Web Applications and Web Servers;1394
47.2.1;The Role of IIS Virtual Directories;1395
47.2.2;The ASP.NET Development Web Server;1396
47.3;The Role of HTML;1396
47.3.1;HTML Document Structure;1397
47.3.2;The Role of an HTML Form;1398
47.3.3;The Visual Studio 2010 HTML Designer Tools;1398
47.3.4;Building an HTML Form;1400
47.4;The Role of Client-Side Scripting;1402
47.4.1;A Client-Side Scripting Example;1403
47.5;Posting Back to the Web Server;1404
47.5.1;Postbacks under ASP.NET;1405
47.6;The Feature Set of the ASP.NET API;1405
47.6.1;Major Features of ASP.NET 1.0-1.1;1406
47.6.2;Major Features of ASP.NET 2.0;1407
47.6.3;Major Features of ASP.NET 3.5 (and .NET 3.5 SP1);1408
47.6.4;Major Features of ASP.NET 4.0;1408
47.7;Building a Single File ASP.NET Web Page;1409
47.7.1;Referencing AutoLotDAL.dll;1410
47.7.2;Designing the UI;1410
47.7.3;Adding the Data Access Logic;1411
47.7.4;The Role of ASP.NET Directives;1415
47.7.5;Analyzing the “Script” Block;1417
47.7.6;Analyzing the ASP.NET Control Declarations;1417
47.7.7;Compilation Cycle for Single-File Pages;1419
47.8;Building an ASP.NET Web Page using Code Files;1420
47.8.1;Referencing the AutoLotDAL.dll Assembly;1423
47.8.2;Updating the Code File;1423
47.8.3;Compilation Cycle for Multifile Pages;1424
47.8.4;Debugging and Tracing ASP.NET Pages;1424
47.9;ASP.NET Web Sites and ASP.NET Web Applications;1426
47.10;The ASP.NET Web Site Directory Structure;1427
47.10.1;Referencing Assemblies;1428
47.10.2;The Role of the App_Code Folder;1429
47.11;The Inheritance Chain of the Page Type;1430
47.12;Interacting with the Incoming HTTP Request;1431
47.12.1;Obtaining Brower Statistics;1433
47.12.2;Access to Incoming Form Data;1433
47.12.3;The IsPostBack Property;1434
47.13;Interacting with the Outgoing HTTP Response;1435
47.13.1;Emitting HTML Content;1436
47.13.2;Redirecting Users;1436
47.14;The Life Cycle of an ASP.NET Web Page;1437
47.14.1;The Role of the AutoEventWireup Attribute;1438
47.14.2;The Error Event;1439
47.15;The Role of the Web.config File;1441
47.15.1;The ASP.NET Website Administration Utility;1442
47.16;Summary;1442
48;CHAPTER 33 ASP.NET Web Controls, Master Pages and Themes
;1443
48.1;Understanding the Nature of Web Controls;1443
48.1.1;Understanding Server-Side Event Handling;1444
48.1.2;The AutoPostBack Property;1445
48.2;The Control and WebControl Base Classes;1446
48.2.1;Enumerating Contained Controls;1446
48.2.2;Dynamically Adding and Removing Controls;1449
48.2.3;Interacting with Dynamically Created Controls;1450
48.2.4;Functionality of the WebControl Base Class;1451
48.3;Major Categories of ASP.NET Web Controls;1452
48.3.1;A Brief Word Regarding System.Web.UI.HtmlControls;1454
48.3.2;Web Control Documentation;1455
48.4;Building the ASP.NET Cars Web Site;1455
48.4.1;Working with ASP.NET Master Pages;1456
48.4.1.1;Working with the TreeView Control Site Navigation Logic;1459
48.4.1.2;Establishing Bread Crumbs with the SiteMapPath Type;1461
48.4.1.3;Working with the AdRotator;1461
48.4.2;Defining the Default Content Page;1462
48.4.3;Designing the Inventory Content Page;1464
48.4.3.1;Enabling Sorting and Paging;1467
48.4.3.2;Enabling In-Place Editing;1468
48.4.4;Designing the Build-a-Car Content Page;1469
48.5;The Role of the Validation Controls;1471
48.5.1;The RequiredFieldValidator;1473
48.5.2;The RegularExpressionValidator;1474
48.5.3;The RangeValidator;1474
48.5.4;The CompareValidator;1475
48.5.5;Creating Validation Summaries;1476
48.5.6;Defining Validation Groups;1477
48.6;Working with Themes;1479
48.6.1;Understanding *.skin Files;1480
48.6.2;Applying Sitewide Themes;1482
48.6.3;Applying Themes at the Page Level;1483
48.6.4;The SkinID Property;1483
48.6.5;Assigning Themes Programmatically;1483
48.7;Summary;1485
49;CHAPTER 34 ASP.NET State Management Techniques
;1486
49.1;The Issue of State;1486
49.2;ASP.NET State Management Techniques;1489
49.3;Understanding the Role of ASP.NET View State;1489
49.3.1;Demonstrating View State;1490
49.3.2;Adding Custom View State Data;1491
49.4;The Role of the Global.asax File;1492
49.4.1;The Global Last-Chance Exception Event Handler;1494
49.4.2;The HttpApplication Base Class;1495
49.5;Understanding the Application/Session Distinction;1496
49.5.1;Maintaining Application-Level State Data;1497
49.5.2;Modifying Application Data;1499
49.5.3;Handling Web Application Shutdown;1501
49.6;Working with the Application Cache;1501
49.6.1;Fun with Data Caching;1502
49.6.2;Modifying the *.aspx File;1504
49.7;Maintaining Session Data;1506
49.7.1;Additional Members of HttpSessionState;1509
49.8;Understanding Cookies;1510
49.8.1;Creating Cookies;1511
49.8.2;Reading Incoming Cookie Data;1512
49.9;The Role of the Element;1513
49.9.1;Storing Session Data in the ASP.NET Session State Server;1513
49.9.2;Storing Session Data in a Dedicated Database;1515
49.10;Understanding the ASP.NET Profile API;1515
49.10.1;The ASPNETDB.mdf Database;1516
49.10.2;Defining a User Profile Within Web.config;1517
49.10.3;Accessing Profile Data Programmatically;1518
49.10.4;Grouping Profile Data and Persisting Custom Objects;1520
49.11;Summary;1522
50;APPENDIX A Programming with Windows Forms
;1523
50.1;The Windows Forms Namespaces;1524
50.2;Building a Simple Windows Forms Application;1525
50.2.1;Populating the Controls Collection;1527
50.2.2;The Role of System.EventArgs and System.EventHandler;1529
50.3;The Visual Studio Windows Forms Project Template;1530
50.3.1;The Visual Designer Surface;1531
50.3.2;Dissecting the Initial Form;1532
50.3.3;Dissecting the Program Class;1533
50.3.4;Visually Building a Menu System;1534
50.4;The Anatomy of a Form;1537
50.4.1;The Functionality of the Control Class;1538
50.4.2;The Functionality of the Form Class;1541
50.4.3;The Life Cycle of a Form Type;1543
50.5;Responding to Mouse and Keyboard Activity;1546
50.5.1;Determining Which Mouse Button Was Clicked;1547
50.5.2;Determining Which Key Was Pressed;1548
50.6;Designing Dialog Boxes;1550
50.6.1;The DialogResult Property;1551
50.6.2;Configuring the Tab Order;1552
50.6.3;The Tab Order Wizard;1552
50.6.4;Setting the Form’s Default Input Button;1553
50.6.5;Displaying Dialog Boxes;1554
50.6.6;Understanding Form Inheritance;1555
50.7;Rendering Graphical Data Using GDI+;1557
50.7.1;The System.Drawing Namespace;1559
50.7.2;The Role of the Graphics Type;1560
50.7.3;Obtaining a Graphics Object with the Paint Event;1561
50.7.4;Invalidating the Form’s Client Area;1563
50.8;Building a Complete Windows Forms Application;1563
50.8.1;Building the Main Menu System;1564
50.8.2;Defining the ShapeData Type;1565
50.8.3;Defining the ShapePickerDialog Type;1565
50.8.4;Adding Infrastructure to the MainWindow Type;1567
50.8.5;Implementing the Tools Menu Functionality;1567
50.8.6;Capturing and Rendering the Graphical Output;1569
50.8.7;Implementing the Serialization Logic;1570
50.9;Summary;1572
51;APPENDIX B Platform-Independent .NET Development with Mono
;1573
51.1;The Platform-Independent Nature of .NET;1573
51.1.1;The Role of the CLI;1574
51.1.2;The Mainstream CLI Distributions;1575
51.1.3;The Scope of Mono;1576
51.2;Obtaining and Installing Mono;1577
51.2.1;Examining Mono’s Directory Structure;1579
51.3;The Mono Development Languages;1581
51.3.1;Working with the C# Compiler;1581
51.3.2;Building Mono Applications using MonoDevelop;1581
51.4;Microsoft-Compatible Mono Development Tools;1582
51.4.1;Mono-Specific Development Tools;1583
51.4.1.1;Using monop;1584
51.5;Building .NET Applications with Mono;1584
51.5.1;Building a Mono Code Library;1584
51.5.1.1;Assigning CoreLibDumper.dll a Strong Name;1586
51.5.1.2;Viewing the Updated Manifest with monodis;1586
51.5.1.3;Installing Assemblies into the Mono GAC;1587
51.5.2;Building a Console Application in Mono;1588
51.5.2.1;Loading Your Client Application in the Mono Runtime;1589
51.5.3;Building a Windows Forms Client Program;1590
51.5.3.1;Executing Your Windows Forms Application Under Linux;1592
51.6;Who is Using Mono?;1593
51.7;Suggestions for Further Study;1593
51.8;Summary;1594
52;Index;1595



Ihre Fragen, Wünsche oder Anmerkungen
Vorname*
Nachname*
Ihre E-Mail-Adresse*
Kundennr.
Ihre Nachricht*
Lediglich mit * gekennzeichnete Felder sind Pflichtfelder.
Wenn Sie die im Kontaktformular eingegebenen Daten durch Klick auf den nachfolgenden Button übersenden, erklären Sie sich damit einverstanden, dass wir Ihr Angaben für die Beantwortung Ihrer Anfrage verwenden. Selbstverständlich werden Ihre Daten vertraulich behandelt und nicht an Dritte weitergegeben. Sie können der Verwendung Ihrer Daten jederzeit widersprechen. Das Datenhandling bei Sack Fachmedien erklären wir Ihnen in unserer Datenschutzerklärung.