Essential C# 2.0 (Paperback)
暫譯: C# 2.0 精要 (平裝本)

Mark Michaelis

  • 出版商: Addison Wesley
  • 出版日期: 2006-07-23
  • 售價: $2,550
  • 貴賓價: 9.5$2,423
  • 語言: 英文
  • 頁數: 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

商品描述(中文翻譯)

描述

“《Essential C# 2.0》完成了一項非常艱難的任務。前幾章對於初學者來說易於理解,而後面的章節則毫不留情地為經驗豐富的開發者提供了他們需要的詳細資訊,以充分利用 C# 2.0。從第一章開始,Mark 成功地將對於即使是最先進的開發者也有用的資訊交織在一起,同時保持了本書的可讀性。”
—Chris Kinsman,Vertafore 首席架構師,微軟區域總監

“真是令人耳目一新!這本書徹底探討了 C#,而不是對整個 .NET 框架進行掃描。對於新手和專業人士來說都非常有價值。”
—Jon Skeet,C# MVP

“《Essential C# 2.0》是希望快速掌握當今最熱門語言之一的經驗豐富程序員的一站式商店。Mark 提供了 C# 的智能和詳細導覽,為新手提供了堅實的技能基礎,以便構建他們的下一代應用程式。”
—Stephen Toub,MSDN Magazine 技術編輯

“這本書提供了 C# 中所有編程結構的完整、最新的覆蓋。組織得當,使初學者能夠快速上手,並引導更有經驗的程序員進入結構化編程的世界。由於它對 C# 的基本編程結構(如泛型、委託等)的堅定關注,這本書是不可或缺的。對於希望利用這種現代編程語言最新功能來解決日常編程問題的程序員來說,這本書是必不可少的。”
—Narendra Poflee,Itron Inc. IT 整合專家

“《Essential C# 2.0》是所有對 C# 感興趣的程序員的理想書籍。如果你是初學者,你將迅速學會 C# 編程的基礎並熟悉相關概念。文本的流暢性易於跟隨,並且很好地避免了重複已經涵蓋的概念。對於經驗豐富的程序員來說,這本書在其頁面中嵌入了無價的精華,使其成為對於已經熟悉 C# 的程序員來說的好讀物。這將是我在未來幾年內會放在電腦旁邊的書。”
—Michael Stokesbary,Itron Inc. 軟體工程師

《Essential C# 2.0》是一本清晰、簡明的 C# 指南——包括 C# 2.0 中的新特性。本書清楚地為初學者和專家呈現材料,並提供 C# 與其他語言之間的對比和比較。C# 語言的內容涵蓋全面,每個重要的結構都有簡潔的代碼示例進行說明。完整的代碼示例可在線獲得。Mark Michaelis 將材料組織得便於快速查閱。每章開頭的圖形“思維導圖”顯示了涵蓋的材料以及每個主題與整體的關係。

在 C# 介紹之後,讀者將學習到:

- C# 原始數據類型、值類型、引用類型、類型轉換和數組
- 運算符和控制流、循環、條件邏輯和順序編程
- 方法、參數、異常處理和結構化編程
- 類、繼承、構造、介面和面向對象編程
- 形式良好的類型、運算符重載、命名空間和垃圾回收
- 泛型、集合和迭代器
- 反射、屬性和聲明式編程
- 執行緒、同步和多執行緒模式
- 互操作性和不安全代碼
- 支撐 C# 的通用語言基礎設施

C# 2.0 擁有眾多新特性,使語言變得更強大、更高效、更具生產力。這些新特性在本書中得到了徹底的介紹。關於 C# 2.0 主題的單獨附錄幫助讀者快速找到語言的新特性。

無論你是剛開始學習編程的初學者,還是希望學習 C# 的經驗豐富的開發者,或是對學習 C# 2.0 新特性感興趣的資深 C# 程序員,《Essential C# 2.0》都能為你提供快速上手編寫 C# 應用程式所需的一切。

目錄

圖表 xxi
表格 xxiii
前言 xxv
序言 xxvii
致謝 xxxix
關於作者 xli
第一章:介紹 C# 1
你好,世界 2
C# 語法基礎 7
變數的使用 14
控制台輸入和輸出 18
註解 22
通用中間語言和 ILDASM 25
第二章:數據類型 29
基本數字類型 30
更多基本類型 38
null 和 void 49
類型的類別 50
可空修飾符 53
數據類型之間的轉換 53
數組 60
第三章:運算符和控制流 77
運算符 78
引入流程控制 92
代碼塊 ({}) 99
範圍 101
布林表達式 102
位運算符 (<<, >>, |, &, ^, ~) 108
控制流語句,續 113
跳轉語句 124
C# 預處理指令 130
第四章:方法和參數 139
調用方法 140
聲明方法 146
using 指令 151
Main() 的返回值和參數 155
參數 158
遞歸 166
方法重載 169
基本的異常處理 171
第五章:類 185
定義和實例化類 189
實例字段 193
實例方法 195
使用 this 關鍵字 196
訪問修飾符 202
構造函數 204
靜態 211
const 和 readonly 修飾符 218
屬性 220
嵌套類 232
部分類 234
第六章:繼承 237
派生 238
重寫基類 250
抽象類 263
一切最終都源自 System.Object 268
使用 is 運算符驗證基礎類型 270
使用 as 運算符進行轉換 271
第七章:介面 273
引入介面 274
通過介面實現多態性 275
介面實現 279
在實現類和其介面之間進行轉換 284
介面繼承 285
多重介面繼承 287
通過介面實現多重繼承 288
版本控制 291
介面與類的比較 293
第八章:值類型 297
構造 298
裝箱 305
枚舉 311
第九章:形式良好的類型 323
重寫對象成員 323
運算符重載 334
引用其他程序集 341
定義命名空間 346
XML 註解 349
垃圾回收 353
資源清理 356
第十章:異常處理 365
多種異常類型 365
捕獲異常 367
一般捕獲塊 368
異常處理指南 371

最後瀏覽商品 (1)