Search and Find

Book Title

Author/Publisher

Table of Contents

Show eBooks for my device only:

 

Pro C# 2008 and the .NET 3.5 Platform

of: Andrew Troelsen

Apress, 2008

ISBN: 9781430204220 , 1370 Pages

4. Edition

Format: PDF, Read online

Copy protection: DRM

Windows PC,Mac OSX,Windows PC,Mac OSX geeignet für alle DRM-fähigen eReader Apple iPad, Android Tablet PC's Read Online for: Windows PC,Mac OSX,Linux

Price: 56,70 EUR



More of the content

Pro C# 2008 and the .NET 3.5 Platform


 

Contents

5

About the Author

17

About the Technical Reviewer

18

Acknowledgments

19

Introduction

20

We’re a Team, You and I

20

An Overview of This Book

21

Diving Even Deeper with Five Free Chapters

28

Obtaining This Book’s Source Code

29

Obtaining Updates for This Book

29

Contacting Me

29

Introducing C# and the . NET Platform

30

The Philosophy of .NET

31

Understanding the Previous State of Affairs

31

The . NET Solution

34

Introducing the Building Blocks of the . NET Platform ( the CLR, CTS, and CLS)

34

Additional . NET- Aware Programming Languages

37

An Overview of . NET Assemblies

39

Understanding the Common Type System

45

Understanding the Common Language Specification

48

Understanding the Common Language Runtime

50

The Assembly/ Namespace/ Type Distinction

51

Exploring an Assembly Using ildasm. exe

56

Exploring an Assembly Using Lutz Roeder’s Reflector

59

Deploying the . NET Runtime

59

The Platform- Independent Nature of . NET

60

Summary

61

Building C# Applications

62

The Role of the . NET Framework 3.5 SDK

62

Building C# Applications Using csc. exe

63

Building . NET Applications Using TextPad

69

Building . NET Applications Using Notepad++

73

Building . NET Applications Using SharpDevelop

75

Building . NET Applications Using Visual C# 2008 Express

77

Building . NET Applications Using Visual Studio 2008

79

A Partial Catalog of Additional . NET Development Tools

91

Summary

92

Core C# Programming Constructs

93

Core C# Programming Constructs, Part I

94

The Anatomy of a Simple C# Program

94

An Interesting Aside: Some Additional Members of the System. Environment Class

100

The System. Console Class

101

System Data Types and C# Shorthand Notation

105

Understanding the System. String Type

111

Narrowing and Widening Data Type Conversions

120

C# Iteration Constructs

125

Decision Constructs and the Relational/ Equality Operators

127

Summary

129

Core C# Programming Constructs, Part II

131

Methods and Parameter Modifiers

131

Understanding Member Overloading

137

Array Manipulation in C#

138

Understanding the Enum Type

145

Understanding the Structure Type

150

Understanding Value Types and Reference Types

153

Value and Reference Types: Final Details

159

Understanding C# Nullable Types

160

Summary

163

Defining Encapsulated Class Types

164

Introducing the C# Class Type

164

Understanding Class Constructors

167

The Role of the this Keyword

170

Understanding the static Keyword

175

Defining the Pillars of OOP

182

C# Access Modifiers

186

The First Pillar: C#’s Encapsulation Services

187

Understanding Constant Data

196

Understanding Read- Only Fields

197

Understanding Partial Types

198

Documenting C# Source Code via XML

199

Visualizing the Fruits of Our Labor

205

Summary

205

Understanding Inheritance and Polymorphism

207

The Basic Mechanics of Inheritance

207

Revising Visual Studio Class Diagrams

211

The Second Pillar: The Details of Inheritance

212

Programming for Containment/ Delegation

218

The Third Pillar: C#’s Polymorphic Support

221

Understanding Base Class/ Derived Class Casting Rules

232

The Master Parent Class: System. Object

234

Summary

240

Understanding Structured Exception Handling

241

Ode to Errors, Bugs, and Exceptions

241

The Role of . NET Exception Handling

242

The Simplest Possible Example

244

Configuring the State of an Exception

248

System- Level Exceptions ( System. SystemException)

252

Application- Level Exceptions ( System. ApplicationException)

253

Processing Multiple Exceptions

258

The Finally Block

261

Who Is Throwing What?

262

The Result of Unhandled Exceptions

263

Debugging Unhandled Exceptions Using Visual Studio

264

Summary

265

Understanding Object Lifetime

266

Classes, Objects, and References

266

The Basics of Object Lifetime

267

The Role of Application Roots

270

Understanding Object Generations

272

The System. GC Type

273

Building Finalizable Objects

277

Building Disposable Objects

280

Building Finalizable and Disposable Types

283

Summary

286

Advanced C# Programming Constructs

287

Working with Interfaces

288

Understanding Interface Types

288

Defining Custom Interfaces

291

Implementing an Interface

293

Invoking Interface Members at the Object Level

295

Interfaces As Parameters

297

Interfaces As Return Values

299

Arrays of Interface Types

300

Implementing Interfaces Using Visual Studio 2008

301

Resolving Name Clashes via Explicit Interface Implementation

302

Designing Interface Hierarchies

305

Building Enumerable Types ( IEnumerable and IEnumerator)

308

Building Cloneable Objects ( ICloneable)

314

Building Comparable Objects ( IComparable)

318

Understanding Callback Interfaces

323

Summary

327

Collections and Generics

328

The Interfaces of the System. Collections Namespace

328

The Class Types of System. Collections

331

System. Collections. Specialized Namespace

335

The Boxing, Unboxing, and System. Object Relationship

335

The Issue of Type Safety and Strongly Typed Collections

338

The System. Collections. Generic Namespace

343

Creating Custom Generic Methods

346

Creating Generic Structures and Classes

349

Creating a Custom Generic Collection

351

Creating Generic Base Classes

356

Creating Generic Interfaces

357

Summary

358

Delegates, Events, and Lambdas

359

Understanding the . NET Delegate Type

359

Defining a Delegate in C#

360

The System. MulticastDelegate and System. Delegate Base Classes

362

The Simplest Possible Delegate Example

363

Retrofitting the Car Type with Delegates

366

A More Elaborate Delegate Example

371

Understanding Delegate Covariance

376

Creating Generic Delegates

378

Understanding C# Events

380

The Generic EventHandler< T> Delegate

387

Understanding C# Anonymous Methods

388

Understanding Method Group Conversions

390

The C# 2008 Lambda Operator

392

Summary

399

Indexers, Operators, and Pointers

400

Understanding Indexer Methods

400

Understanding Operator Overloading

405

Understanding Custom Type Conversions

414

Working with Pointer Types

421

C# Preprocessor Directives

428

Summary

431

C# 2008 Language Features

432

Understanding Implicitly Typed Local Variables

432

Understanding Automatic Properties

437

Understanding Extension Methods

441

Understanding Partial Methods

450

Understanding Object Initializer Syntax

453

Understanding Anonymous Types

457

Summary

462

An Introduction to LINQ

463

Understanding the Role of LINQ

463

A First Look at LINQ Query Expressions

466

LINQ and Generic Collections

472

LINQ and Nongeneric Collections

473

The Internal Representation of LINQ Query Operators

475

Investigating the C# LINQ Query Operators

479

LINQ Queries: An Island unto Themselves?

485

Summary

488

Programming with .NET Assemblies

489

Introducing .NET Assemblies

490

Defining Custom Namespaces

490

The Role of . NET Assemblies

495

Understanding the Format of a . NET Assembly

497

Building and Consuming a Single- File Assembly

501

Building and Consuming a Multifile Assembly

511

Understanding Private Assemblies

514

Understanding Shared Assemblies

519

Consuming a Shared Assembly

525

Configuring Shared Assemblies

527

Investigating the Internal Composition of the GAC

531

Understanding Publisher Policy Assemblies

533

Understanding the < codeBase> Element

534

The System. Configuration Namespace

536

The Machine Configuration File

537

Summary

537

Type Reflection, Late Binding, and Attribute- Based Programming

538

The Necessity of Type Metadata

538

Understanding Reflection

542

Building a Custom Metadata Viewer

545

Dynamically Loading Assemblies

551

Reflecting on Shared Assemblies

553

Understanding Late Binding

554

Understanding Attributed Programming

557

Building Custom Attributes

561

Assembly- Level ( and Module- Level) Attributes

564

Reflecting on Attributes Using Early Binding

565

Reflecting on Attributes Using Late Binding

566

Putting Reflection, Late Binding, and Custom Attributes in Perspective

568

Building an Extendable Application

568

Summary

574

Processes, AppDomains, and Object Contexts

575

Reviewing Traditional Win32 Processes

575

Interacting with Processes Under the . NET Platform

577

Understanding . NET Application Domains

585

Understanding Object Context Boundaries

591

Summarizing Processes, AppDomains, and Context

595

Summary

596

Building Multithreaded Applications

597

The Process/ AppDomain/ Context/ Thread Relationship

597

A Brief Review of the . NET Delegate

599

The Asynchronous Nature of Delegates

601

Invoking a Method Asynchronously

602

The System. Threading Namespace

607

The System. Threading. Thread Class

608

Programmatically Creating Secondary Threads

611

The Issue of Concurrency

616

Programming with Timer Callbacks

623

Understanding the CLR ThreadPool

624

The Role of the BackgroundWorker Component

626

Summary

630

Understanding CIL and the Role of Dynamic Assemblies

631

Reflecting on the Nature of CIL Programming

631

Examining CIL Directives, Attributes, and Opcodes

632

Pushing and Popping: The Stack- Based Nature of CIL

634

Understanding Round- Trip Engineering

635

Understanding CIL Directives and Attributes

643

. NET Base Class Library, C#, and CIL Data Type Mappings

649

Defining Type Members in CIL

650

Examining CIL Opcodes

652

Building a . NET Assembly with CIL

657

Understanding Dynamic Assemblies

662

Summary

671

Introducing the .NET Base Class Libraries

672

File I/O and Isolated Storage

673

Exploring the System. IO Namespace

673

The Directory( Info) and File( Info) Types

674

Working with the DirectoryInfo Type

675

Working with the Directory Type

679

Working with the DriveInfo Class Type

680

Working with the FileInfo Class

681

Working with the File Type

685

The Abstract Stream Class

687

Working with StreamWriters and StreamReaders

689

Working with StringWriters and StringReaders

692

Working with BinaryWriters and BinaryReaders

694

Programmatically “ Watching” Files

695

Performing Asynchronous File I/ O

697

Understanding the Role of Isolated Storage

699

A Primer on Code Access Security

700

An Overview of Isolated Storage

710

Obtaining a Store Using IsolatedStorageFile

714

Isolated Storage in Action: ClickOnce Deployment

719

Summary

722

Introducing Object Serialization

723

Understanding Object Serialization

723

Configuring Objects for Serialization

725

Choosing a Serialization Formatter

727

Serializing Objects Using the BinaryFormatter

729

Serializing Objects Using the SoapFormatter

731

Serializing Objects Using the XmlSerializer

732

Serializing Collections of Objects

735

Customizing the Serialization Process

736

Summary

741

ADO.NET Part I: The Connected Layer

742

A High- Level Definition of ADO. NET

742

Understanding ADO. NET Data Providers

744

Additional ADO. NET Namespaces

747

The Types of the System. Data Namespace

748

Abstracting Data Providers Using Interfaces

752

Creating the AutoLot Database

755

The ADO. NET Data Provider Factory Model

760

Understanding the Connected Layer of ADO. NET

766

Working with Data Readers

771

Building a Reusable Data Access Library

774

Creating a Console UI – Based Front End

781

Asynchronous Data Access Using SqlCommand

786

Understanding Database Transactions

788

Summary

792

ADO.NET Part II: The Disconnected Layer

793

Understanding the Disconnected Layer of ADO. NET

793

Understanding the Role of the DataSet

794

Working with DataColumns

797

Working with DataRows

799

Working with DataTables

803

Binding DataTable Objects to User Interfaces

808

Filling DataSet/ DataTable Objects Using Data Adapters

818

Revisiting AutoLotDAL. dll

821

Navigating Multitabled DataSet Objects

824

The Data Access Tools of Visual Studio 2008

830

Decoupling Autogenerated Code from the UI Layer

841

Summary

845

Programming with the LINQ APIs

846

The Role of LINQ to ADO. NET

846

Programming with LINQ to DataSet

847

Programming with LINQ to SQL

852

Generating Entity Classes Using SqlMetal. exe

857

Building Entity Classes Using Visual Studio 2008

863

Manipulating XML Documents Using LINQ to XML

866

Navigating an In- Memory Document

871

Summary

874

Introducing Windows Communication Foundation

875

A Potpourri of Distributed Computing APIs

875

The Role of WCF

881

Investigating the Core WCF Assemblies

884

The Visual Studio WCF Project Templates

885

The Basic Composition of a WCF Application

887

The ABCs of WCF

888

Building a WCF Service

893

Hosting the WCF Service

896

Building the WCF Client Application

904

Using the WCF Service Library Project Template

908

Hosting the WCF Service As a Windows Service

911

Invoking a Service Asynchronously

916

Designing WCF Data Contracts

918

Summary

923

Introducing Windows Workflow Foundation

924

Defining a Business Process

924

The Building Blocks of WF

925

WF Assemblies, Namespaces, and Projects

931

Building a Simple Workflow- Enabled Application

933

Examining the WF Engine Hosting Code

937

Invoking Web Services Within Workflows

941

Building a Reusable WF Code Library

952

A Brief Word Regarding Custom Activities

958

Summary

959

Desktop User Interfaces

960

Programming with Windows Forms

961

The Windows Forms Namespaces

961

Building a Simple Windows Forms Application ( IDE- Free)

962

The Visual Studio Windows Forms Project Template

967

The Anatomy of a Form

974

Responding to Mouse Activity

981

Responding to Keyboard Activity

983

Designing Dialog Boxes

984

Rendering Graphical Data Using GDI+

991

Building a Complete Windows Forms Application

996

Summary

1003

Introducing Windows Presentation Foundation and XAML

1005

The Motivation Behind WPF

1005

The Various Flavors of WPF Applications

1008

Investigating the WPF Assemblies

1010

Building a ( XAML- Free) WPF Application

1017

Additional Details of the Application Type

1021

Additional Details of the Window Type

1023

Building a ( XAML- Centric) WPF Application

1027

Transforming Markup into a . NET Assembly

1031

Separation of Concerns Using Code- Behind Files

1035

The Syntax of XAML

1037

Building WPF Applications Using Visual Studio 2008

1050

Processing XAML at Runtime: SimpleXamlPad. exe

1054

The Role of Microsoft Expression Blend

1058

Summary

1059

Programming with WPF Controls

1061

A Survey of the WPF Control Library

1061

Declaring Controls in XAML

1064

Understanding the Role of Dependency Properties

1066

Understanding Routed Events

1070

Working with Button Types

1074

Working with CheckBoxes and RadioButtons

1078

Working with the ListBox and ComboBox Types

1081

Working with Text Areas

1087

Controlling Content Layout Using Panels

1089

Building a Window’s Frame Using Nested Panels

1099

Understanding WPF Control Commands

1105

Understanding the WPF Data- Binding Model

1108

Data Conversion Using IValueConverter

1112

Binding to Custom Objects

1114

Binding UI Elements to XML Documents

1118

Summary

1122

WPF 2D Graphical Rendering, Resources, and Themes

1123

The Philosophy of WPF Graphical Rendering Services

1123

Exploring the Shape- Derived Types

1130

Working with WPF Brushes

1133

Working with WPF Pens

1136

Exploring the Drawing- Derived Types

1136

The Role of UI Transformations

1141

Understanding WPF’s Animation Services

1142

Understanding the WPF Resource System

1151

Defining and Applying Styles for WPF Controls

1153

Altering a Control’s UI Using Templates

1162

Summary

1166

Building Web Applications with ASP. NET

1167

Building ASP.NET Web Pages

1168

The Role of HTTP

1168

Understanding Web Applications and Web Servers

1169

The Role of HTML

1172

The Role of Client- Side Scripting

1177

Submitting the Form Data ( GET and POST)

1179

Building a Classic ASP Page

1180

Problems with Classic ASP

1182

The ASP. NET Namespaces

1183

The ASP. NET Web Page Code Model

1184

Details of an ASP. NET Website Directory Structure

1195

The ASP. NET Page Compilation Cycle

1197

The Inheritance Chain of the Page Type

1199

Interacting with the Incoming HTTP Request

1200

Interacting with the Outgoing HTTP Response

1203

The Life Cycle of an ASP. NET Web Page

1205

The Role of the Web. config File

1208

Summary

1211

ASP.NET Web Controls, Themes, and Master Pages

1212

Understanding the Nature of Web Controls

1212

The System. Web. UI. Control Type

1214

The System. Web. UI. WebControls. WebControl Type

1218

Major Categories of ASP. NET Web Controls

1218

Building a Feature- Rich ASP. NET Website

1220

The Role of the Validation Controls

1236

Working with Themes

1242

Positioning Controls Using HTML Tables

1248

Summary

1249

ASP.NET State Management Techniques

1250

The Issue of State

1250

ASP. NET State Management Techniques

1252

Understanding the Role of ASP. NET View State

1253

The Role of the Global. asax File

1256

Understanding the Application/ Session Distinction

1259

Working with the Application Cache

1264

Maintaining Session Data

1268

Understanding Cookies

1272

The Role of the < sessionState> Element

1274

Understanding the ASP. NET Profile API

1277

Summary

1284

Appendixes

1285

COM and .NET Interoperability

1286

The Scope of . NET Interoperability

1286

A Simple Example of . NET to COM Interop

1287

Investigating a . NET Interop Assembly

1290

Understanding the Runtime Callable Wrapper

1292

The Role of COM IDL

1295

Using a Type Library to Build an Interop Assembly

1299

Building a More Elaborate COM Server

1302

Examining the Interop Assembly

1304

Understanding COM to . NET Interoperability

1308

The Role of the CCW

1309

The Role of the . NET Class Interface

1310

Building Your . NET Types

1311

Generating the Type Library and Registering the . NET Types

1313

Examining the Exported Type Information

1314

Building a Visual Basic 6.0 Test Client

1315

Summary

1316

Platform-Independent .NET Development with Mono

1317

The Platform- Independent Nature of . NET

1317

Obtaining and Installing Mono

1320

The Mono Development Tools

1323

Building . NET Applications with Mono

1325

Suggestions for Further Study

1332

Summary

1333

Index

1335