Jesse Liberty, Donald Xie9780596527433, 0596527438
Our bestselling Programming C# 3.0, now in its fifth edition, is a world-class tutorial that goes well beyond the documentation otherwise available. Liberty doesn’t just teach C#; he tells the complete story of the C# language and how it integrates with all of .NET programming, so that you can get started creating professional quality web and Windows applications.
This book:
– Provides a comprehensive tutorial in C# and .NET programming that also serves as a useful reference you’ll want by your side while you’re working
– Covers all of the new features of the language, thoroughly integrated into every chapter, rather than tacked on at the end
– Provides insight into best practices and insight into real world programming by a professional programmer who worked with C# as an independent contractor for nearly a decade before joining Microsoft as a Senior Program Manager
– Every chapter in this book has been totally revised, and the entire book has been reorganized to respond to the significant changes in the language
– Full coverage, from the ground up of LINQ (Language Integrated Query) and other C# 3.0 language innovations to speed up development tasks
– Explains how to use C# in creating Web Applications as well as Windows Applications, using both the new Windows Presentation Foundation (WPF) and the older WinForms technology
This new edition of Programming C# 3.0 is for working programmers who want to develop proficiency in Microsoft’s most important language. No prior .NET experience is required for you to get started. There’s no time like the present to work with C# — and no book like this one to teach you everything you need to know.
Special note to VB6 and Java programmers: if you’ve decided to transition to .NET, this book will take you there.
Table of contents :
Programming C# 3.0, Fifth Edition……Page 0
Table of Contents……Page 3
Preface……Page 9
What You Need to Use This Book……Page 10
Part I: The C# Language……Page 11
Part II: C# and Data……Page 12
Part IV: The CLR and the .NET Framework……Page 13
Conventions Used in This Book……Page 14
Support……Page 15
Using Code Examples……Page 16
From Jesse Liberty……Page 17
From Donald Xie……Page 18
Part I The C# Language……Page 19
The Evolution of C#……Page 21
C# Features……Page 22
The .NET Platform……Page 24
Classes, Objects, and Types……Page 25
Methods……Page 26
Comments……Page 27
Namespaces……Page 29
The Dot Operator (.)……Page 30
The using Directive……Page 31
Developing “Hello World”……Page 32
Editing “Hello World”……Page 33
Compiling and Running “Hello World”……Page 35
Using the Visual Studio 2008 Debugger……Page 36
Types……Page 39
The Built-In Types……Page 40
Choosing a built-in type……Page 41
Converting built-in types……Page 42
Variables and Constants……Page 43
Definite Assignment……Page 45
Constants……Page 46
Enumerations……Page 48
Identifiers……Page 50
Statements……Page 51
Unconditional Branching Statements……Page 52
if…else statements……Page 53
Nested if statements……Page 55
switch statements: an alternative to nested ifs……Page 56
The goto statement……Page 60
The while loop……Page 61
The for loop……Page 62
The continue and break statements……Page 65
The Assignment Operator (=)……Page 67
The modulus operator (%) to return remainders……Page 68
Calculate and reassign operators……Page 70
The prefix and postfix operators……Page 71
Relational Operators……Page 72
Operator Precedence……Page 73
The Ternary Operator……Page 76
Defining Identifiers……Page 77
#if, #elif, #else, and #endif……Page 78
Classes and Objects……Page 79
Defining Classes……Page 80
Access Modifiers……Page 83
Method Arguments……Page 84
Creating Objects……Page 85
Constructors……Page 86
Initializers……Page 88
The this Keyword……Page 91
Using Static Members……Page 93
Using Static Constructors……Page 94
Using Static Fields……Page 96
Destroying Objects……Page 97
Destructors Versus Dispose……Page 98
The using Statement……Page 100
Passing by Reference……Page 101
Overcoming Definite Assignment with out Parameters……Page 104
Overloading Methods and Constructors……Page 107
Encapsulating Data with Properties……Page 110
The get Accessor……Page 112
Property Access Modifiers……Page 113
readonly Fields……Page 114
Specialization and Generalization……Page 116
Implementing Inheritance……Page 119
Creating Polymorphic Methods……Page 120
Calling Base Class Constructors……Page 124
Versioning with the new and override Keywords……Page 125
Abstract Classes……Page 127
Limitations of Abstract……Page 129
Sealed Class……Page 130
The Root of All Types: Object……Page 131
Nesting Classes……Page 133
Using the operator Keyword……Page 136
Supporting Other .NET Languages……Page 137
The Equality Operator……Page 138
Putting Operators to Work……Page 139
Structs……Page 145
Defining Structs……Page 146
Creating Structs……Page 147
Structs As Value Types……Page 148
Defining and Implementing an Interface……Page 150
Extending Interfaces……Page 154
Combining Interfaces……Page 155
Polymorphism with Interfaces……Page 158
Interface Versus Abstract Class……Page 164
Overriding Interface Implementations……Page 165
Explicit Interface Implementation……Page 169
Selectively Exposing Interface Methods……Page 171
Member Hiding……Page 172
Arrays……Page 174
Declaring Arrays……Page 176
Understanding Default Values……Page 177
Accessing Array Elements……Page 178
The foreach Statement……Page 180
Initializing Array Elements……Page 181
The params Keyword……Page 182
Rectangular arrays……Page 183
Jagged arrays……Page 187
Array Bounds……Page 190
Array Conversions……Page 191
Sorting Arrays……Page 193
Indexers……Page 195
Indexers and Assignment……Page 199
Indexing on Other Values……Page 201
Collection Interfaces……Page 204
The IEnumerable Interface……Page 205
Constraints……Page 208
List……Page 213
Implementing IComparable……Page 216
Implementing IComparer……Page 219
Queues……Page 224
Stacks……Page 226
Dictionaries……Page 229
IDictionary……Page 230
Strings and Regular Expressions……Page 232
Strings……Page 233
Creating Strings……Page 234
Manipulating Strings……Page 235
Finding Substrings……Page 241
Splitting Strings……Page 244
Manipulating Dynamic Strings……Page 245
Regular Expressions……Page 247
Using Regular Expressions: Regex……Page 248
Using Regex Match Collections……Page 250
Using Regex Groups……Page 252
Using CaptureCollection……Page 255
Exceptions……Page 259
The throw Statement……Page 260
The catch Statement……Page 262
Unwinding the call stack……Page 264
Try/Catch Best Practices……Page 266
The finally Statement……Page 268
Exception Objects……Page 270
Events……Page 274
Events and Delegates……Page 275
Publish and Subscribe/Observer……Page 276
The Publishing Class: Clock……Page 280
Registering to Be Notified……Page 282
The Danger with Delegates……Page 284
The event Keyword……Page 285
Lambda Expressions……Page 289
Callback Methods……Page 290
Part II C# and Data……Page 295
Introducing LINQ……Page 297
Defining and Executing a Query……Page 298
Filtering……Page 300
Deferred Query Evaluation……Page 301
Joining……Page 303
Ordering and the var Keyword……Page 304
Grouping and the group Keyword……Page 308
Implicitly Typed Local Variables……Page 309
Extension Methods……Page 310
Defining and Using Extension Methods……Page 312
Extension Method Restrictions……Page 314
Lambda Expressions in LINQ……Page 315
XML Basics (A Quick Review)……Page 320
Elements……Page 321
Creating XML Documents……Page 322
XML Elements……Page 326
XML Attributes……Page 327
Searching in XML with XPath……Page 329
Searching for a Single Node……Page 336
Searching Using Axes……Page 337
Predicates……Page 338
XPath Functions……Page 339
Searching Using XPathNavigator……Page 340
Using XPathNodeIterator……Page 345
Using XPathExpression……Page 346
XML Serialization……Page 347
Customizing XML Serialization Using Attributes……Page 349
Runtime XML Serialization Customization……Page 351
Putting LINQ to Work……Page 355
Getting Set Up……Page 356
LINQ to SQL Fundamentals……Page 357
Using Visual Studio LINQ to SQL Designer……Page 362
Retrieving Data……Page 367
Creating Properties for Each Table……Page 368
A LINQ Query……Page 370
Updating Data Using LINQ to SQL……Page 371
Adding a Customer Record……Page 374
Modifying a Customer Record……Page 375
Deleting Relational Data……Page 376
LINQ to XML……Page 381
Relational Databases and SQL……Page 386
Tables, Records, and Columns……Page 387
Declarative Referential Integrity……Page 388
SQL……Page 389
The ADO.NET Object Model……Page 390
Data Adapter……Page 391
Getting Started with ADO.NET……Page 392
Part III Programming with C#……Page 397
Web Forms Fundamentals……Page 399
Postback versus nonpostback events……Page 401
Web Forms Life Cycle……Page 402
Creating a Web Form……Page 403
Code-Behind Files……Page 404
Adding Controls……Page 406
Data Binding……Page 409
Examining the Code……Page 413
Adding Controls and Events……Page 417
WPF in a Very Small Nutshell……Page 422
The Example Program……Page 423
Grids and Stack Panels……Page 424
Our goals……Page 427
Adding Data……Page 430
Instantiating objects declaratively……Page 431
Defining the Listbox……Page 432
The Complete XAML File……Page 433
Event Handling (Finally!)……Page 436
What Have You Learned, Dorothy?……Page 437
Creating the Application……Page 438
Creating Event Handlers……Page 441
Populating the TreeView Controls……Page 442
TreeNode objects……Page 443
Recursing through the subdirectories……Page 445
Getting the files in the directory……Page 446
Clicking the source TreeView……Page 447
Expanding a directory……Page 448
Clicking the target TreeView……Page 449
Implementing the Copy Button Event……Page 450
Getting the selected files……Page 451
Sorting the list of selected files……Page 452
Handling the Delete Button Event……Page 454
Part IV The CLR and the .NET Framework……Page 465
Attributes……Page 467
Applying attributes……Page 468
Custom Attributes……Page 469
Naming an attribute……Page 470
Using an attribute……Page 471
Viewing Metadata……Page 474
Type Discovery……Page 476
Finding all type members……Page 477
Finding type methods……Page 478
Finding particular type members……Page 479
Late Binding……Page 480
Threads and Synchronization……Page 483
Starting Threads……Page 484
Blocking Threads with Sleep……Page 487
Killing Threads……Page 488
Synchronization……Page 492
Using Interlocked……Page 495
Using Locks……Page 497
Using Monitors……Page 498
Deadlocks……Page 503
Streams……Page 505
Working with Directories……Page 506
Creating a DirectoryInfo Object……Page 507
Working with Files……Page 510
Modifying Files……Page 514
Reading and Writing Data……Page 517
Binary Files……Page 518
Buffered Streams……Page 520
Working with Text Files……Page 522
Asynchronous I/O……Page 524
Network I/O……Page 529
Creating a Network Streaming Server……Page 531
Creating a Streaming Network Client……Page 533
Handling Multiple Connections……Page 536
Asynchronous Network File Streaming……Page 540
Web Streams……Page 545
Serialization……Page 547
Working with Serialization……Page 548
Serializing the object……Page 549
Deserializing the object……Page 550
Handling Transient Data……Page 553
Isolated Storage……Page 556
Creating an ActiveX Control……Page 560
Importing a Control in .NET……Page 564
Importing a control……Page 565
Adding the control to the form……Page 566
P/Invoke……Page 569
Pointers……Page 572
C# Keywords……Page 579
Index……Page 587
Reviews
There are no reviews yet.