HAPPY BOOKSGIVING
Use code BOOKSGIVING during checkout to save 40%-55% on books and eBooks. Shop now.
Register your product to gain access to bonus material or receive a coupon.
Whether you need an approachable on-ramp to .NET or you want to enhance your skills, C# 3.0 Unleashed is a comprehensive, in-depth guide to the solutions you seek. You’ll learn to do more with the new tools that are available, including Visual Studio 2008 and the .NET Framework Class Libraries. Throughout this book, you’ll get a practical look at what can be the most useful tools for any given task. You’ll also learn common traps to avoid and learn insightful tips that will save you time and help you be more productive.
C# 3.0 Unleashed contains complete coverage of the C# programming language. The author covers all the essential syntax, but keeps the focus on practical application. The chapters are arranged to take you step-by-step from the core of the C# language to elements of the .NET Framework, and further into advanced concepts on distributed n-tier Internet applications. Additionally, C# 3.0 Unleashed shows you how to debug, monitor, and scale enterprise applications, enabling you to use the C# programming language to ship the right code at the right time.
What’s included in this book:
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
Part 1 Learning C# Basics
1 Introducing the .NET Platform. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2 Getting Started with C# and Visual Studio 2008 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3 Writing C# Expressions and Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49
4 Understanding Reference Types and Value Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
5 Manipulating Strings. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
6 Arrays and Enums . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
7 Debugging Applications with Visual Studio 2008 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
Part 2 Object-Oriented Programming with C#
8 Designing Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163
9 Designing Object-Oriented Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177
10 Coding Methods and Custom Operators. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
11 Error and Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
12 Event-Based Programming with Delegates and Events. . . . . . . . . . . . . . . . . . . . . . . . . 249
13 Naming and Organizing Types with Namespaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 273
14 Implementing Abstract Classes and Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 287
Part 3 Applying Advanced C# Language Features
15 Managing Object Lifetime. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 319
16 Declaring Attributes and Examining Code with Reflection. . . . . . . . . . . . . . . . . . . 339
17 Parameterizing Type with Generics and Writing Iterators . . . . . . . . . . . . . . . . . . . . 365
18 Using Lambda Expressions and Expression Trees. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 397
Part 4 Learning LINQ and .NET Data Access
19 Accessing Data with LINQ. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
20 Managing Data with ADO.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 441
21 Manipulating XML Data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 461
22 Creating Data Abstractions with the ADO.NET Entity Framework . . . . . . . . . 475
23 Working with Data in the Cloud with ADO.NET Data Services . . . . . . . . . . . . . 491
Part 5 Building Desktop User Interfaces
24 Taking Console Applications to the Limit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507
25 Writing Windows Forms Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
26 Creating Windows Presentation Foundation (WPF) Applications . . . . . . . . . . 547
Part 6 Designing Web User Interfaces
27 Building Web Applications with ASP.NET . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 583
28 Adding Interactivity to Your Web Apps with ASP.NET AJAX. . . . . . . . . . . . . . . . . 619
29 Crafting Rich Web Applications with Silverlight . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
Part 7 Communicating with .NET Technologies
30 Using .NET Network Communications Technologies . . . . . . . . . . . . . . . . . . . . . . . . . . 661
31 Building Windows Service Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 679
32 Remoting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 695
33 Writing Traditional ASMX Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 713
34 Creating Web and Services with WCF . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 725
Part 8 Examining .NET Application Architecture and Design
35 Using the Visual Studio 2008 Class Designer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 743
36 Sampling Design Patterns in C# . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 755
37 Building N-Tier/Layer Systems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 779
38 Automating Logic with Windows Workflow. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 797
Part 9 Surveying More of the .NET Framework Class Library
39 Managing Processes and Threads. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 817
40 Localizing and Globalization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 831
41 Performing Interop (P/Invoke and COM) and Writing Unsafe Code . . . . . . 853
42 Instrumenting Applications with System.Diagnostics Types . . . . . . . . . . . . . . . . . 879
Part 10 Deploying Code
43 Assemblies and Versioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 921
44 Securing Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 933
45 Creating Visual Studio 2008 Setup Projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 947
46 Deploying Desktop Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 955
47 Publishing Web Applications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 961
Part 11 Appendixes
A Compiling Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 969
B Getting Help with the .NET Framework. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 973
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 977