Essential C# 2.0 (Paperback)

Mark Michaelis

  • 出版商: Addison Wesley
  • 出版日期: 2006-07-23
  • 售價: $2,490
  • 貴賓價: 9.5$2,366
  • 語言: 英文
  • 頁數: 768
  • 裝訂: Paperback
  • ISBN: 0321150775
  • ISBN-13: 9780321150776
  • 相關分類: C#
  • 已過版

買這商品的人也買了...

相關主題

商品描述

Description

Essential C# 2.0 pulls off a very difficult task. The early chapters are comprehensible by beginning developers, while the later chapters pull no punches and provide the experienced developer with the detailed information they need to make the most of C# 2.0. Starting with the first chapter, Mark has successfully interwoven tidbits of information useful to even the most advanced developer while keeping the book approachable.”
—Chris Kinsman, chief architect, Vertafore, Microsoft Regional Director
“How refreshing! This book deals with C# thoroughly, rather than skimming over the whole .NET framework. It is valuable to newcomers and professionals alike.”
—Jon Skeet, C# MVP
Essential C# 2.0 is a one-stop shop for an experienced programmer looking to ramp up on one of the hottest languages around today. Mark delivers an intelligent and detailed tour of C#, providing newcomers to the language with a solid foundation of skill on which to build their next generation of applications.”
—Stephen Toub, technical editor, MSDN Magazine
“This book provides complete, up-to-date coverage of all the programming constructs in C#. Masterfully organized, it allows beginning programmers to get on board and leads more experienced programmers into the world of structured programming. Because of its unwavering focus on the essential programming constructs of C#—such as generics, delegates, and much more—this book is indispensable. For programmers who want to solve their day-to-day programming issues using the latest features this modern programming language has to offer, this book is indispensable.”
—Narendra Poflee, IT integration specialist, Itron Inc.
Essential C# 2.0 is an ideal book for all programmers interested in C#. If you are a beginner, you will quickly learn the basics of C# programming and become familiar with the concepts. The flow of the text is easy to follow and does a great job of not repeating concepts that have already been covered. For the experienced programmer, this book has priceless nuggets embedded within its pages, making it a great read for programmers who are already familiar with C#. This will be a book that I will keep next to my computer for years to come.”
—Michael Stokesbary, software engineer, Itron Inc.

Essential C# 2.0 is a clear, concise guide to C#—including the features new to C# 2.0. The book clearly presents material for beginners and experts and provides contrasts and comparisons between C# and other languages. The C# language is covered comprehensively and each important construct is illustrated with succinct code examples. Complete code examples are available online. Mark Michaelis has organized the material for quick access. Graphical “mind maps” at the beginning of each chapter show what material is covered and how each topic relates to the whole.

Following the C# introduction, readers will learn about

  • C# primitive data types, value types, reference types, type conversions, and arrays
  • Operators and control flow, loops, conditional logic, and sequential programming
  • Methods, parameters, exception handling, and structured programming
  • Classes, inheritance, structures, interfaces, and object-oriented programming
  • Well-formed types, operator overloading, namespaces, and garbage collection
  • Generics, collections, and iterators
  • Reflection, attributes, and declarative programming
  • Threading, synchronization, and multi-threaded patterns
  • Interoperability and unsafe code
  • The Common Language Infrastructure that underlies C#

C# 2.0 has a multitude of new features that make the language even more powerful, productive, and efficient. These new features are thoroughly covered in this book. A separate appendix on C# 2.0 topics helps readers quickly find new features of the language.

Whether you’re just starting out as a programmer, are an experienced developer looking to learn C#, or are a seasoned C# programmer interested in learning the new features of C# 2.0, Essential C# 2.0 gives you just what you need to quickly get up and running writing C# applications.

 

 

Table of Contents

Figures xxiTables xxiiiForeword xxvPreface xxviiAcknowledgments xxxixAbout the Author xliChapter 1: Introducing C# 1

Hello, World 2

C# Syntax Fundamentals 7

Working with Variables 14

Console Input and Output 18

Comments 22

Common Intermediate Language and ILDASM 25

Chapter 2: Data Types 29

Fundamental Numeric Types 30

More Fundamental Types 38

null and void 49

Categories of Types 50

Nullable Modifier 53

Conversions between Data Types 53

Arrays 60

Chapter 3: Operators and Control Flow 77

Operators 78

Introducing Flow Control 92

Code Blocks ({}) 99

Scope 101

Boolean Expressions 102

Bitwise Operators (<<, >>, |, &, ^, ~) 108

Control Flow Statements, Continued 113

Jump Statements 124

C# Preprocessor Directives 130

Chapter 4: Methods and Parameters 139

Calling a Method 140

Declaring a Method 146

The using Directive 151

Returns and Parameters on Main() 155

Parameters 158

Recursion 166

Method Overloading 169

Basic Error Handling with Exceptions 171

Chapter 5: Classes 185

Defining and Instantiating a Class 189

Instance Fields 193

Instance Methods 195

Using the this Keyword 196

Access Modifiers 202

Constructors 204

Static 211

const and readonly Modifiers 218

Properties 220

Nested Classes 232

Partial Classes 234

Chapter 6: Inheritance 237

Derivation 238

Overriding the Base Class 250

Abstract Classes 263

Everything Ultimately Derives from System.Object 268

Verifying the Underlying Type with the is Operator 270

Conversion Using the as Operator 271

Chapter 7: Interfaces 273

Introducing Interfaces 274

Polymorphism through Interfaces 275

Interface Implementation 279

Casting between the Implementing Class and Its Interfaces 284

Interface Inheritance 285

Multiple Interface Inheritance 287

Implementing Multiple Inheritance via Interfaces 288

Versioning 291

Interfaces Compared with Classes 293

Chapter 8: Value Types 297

Structs 298

Boxing 305

Enums 311

Chapter 9: Well-Formed Types 323

Overriding object Members 323

Operator Overloading 334

Referencing Other Assemblies 341

Defining Namespaces 346

XML Comments 349

Garbage Collection 353

Resource Cleanup 356

Chapter 10: Exception Handling 365

Multiple Exception Types 365

Catching Exceptions 367

General Catch Block 368

Guidelines for Exception Handling 371

Defining Custom Exceptions 373

Chapter 11: Generics 379

C# without Generics 380

Introducing Generic Types 385

Constraints 396

Generic Methods 409

Generic Internals 413

Chapter 12: Collections 419

Primary Collection Classes 420

Introducing Collection Class Interfaces 433

Providing an Index Operator 444

Returning Null or an Empty Collection 448

Iterators 448

Chapter 13: Delegates and Events 465

Method Pointers 466

Multicast Delegates and the Observer Pattern 482

Events 496

Chapter 14: Reflection and Attributes 509

Reflection 510

Attributes 520

Chapter 15: Multithreading 549

Running and Controlling a Separate Thread 552

Passing Parameters to Threads 557

Thread Pooling 561

Unhandled Exceptions 563

Synchronization 565

Timers 584

Chapter 16: Multithreading Patterns 591

Asynchronous Results Pattern 592

Background Worker Pattern 606

Windows Forms 611

Chapter 17: Platform Interoperability and Unsafe Code 615

Platform Invoke 616

Pointers and Addresses 630

Chapter 18: The Common Language Infrastructure 641

Defining the Common Language Infrastructure (CLI) 642

CLI Implementations 643

C# Compilation to Machine Code 644

Runtime 647

Application Domains 652

Assemblies, Manifests, and Modules 653

Common Intermediate Language (CIL) 656

Common Type System (CTS) 656

Common Language Specification (CLS) 657

Base Class Library (BCL) 658

Metadata 658

Appendix A: Downloading and Installing the C# Compiler and the CLI Platform 663Appendix B: Complete Source Code Listings 667Appendix C: C# 2.0 Topics 693Index 697