C# Primer Plus
暫譯: C# 基礎精要

Klaus Michelsen

  • 出版商: SAMS
  • 出版日期: 2001-12-05
  • 售價: $2,160
  • 貴賓價: 9.5$2,052
  • 語言: 英文
  • 頁數: 992
  • 裝訂: Paperback
  • ISBN: 0672321521
  • ISBN-13: 9780672321528
  • 相關分類: C#
  • 已過版

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

相關主題

商品描述

 

C# Primer Plus teaches the C# programming language and relevant parts of the .NET platform from the ground up, walking you through the basics of object-oriented programming, important programming techniques and problem solving while providing a thorough coverage of C#'s essential elements - such as classes, objects, data types, loops, branching statements, arrays, and namespaces.

In early chapters guided tours take you sightseeing to the main attractions of C# and provide a fast learning-path that enables you to quickly write simple C# programs. Your initial programming skills are then gradually expanded, through the many examples, case studies, illustrations, review questions and programming exercises, to include powerful concepts - like inheritance, polymorphism, interfaces and exception handling, along with C#'s most innovative features - such as properties, indexers, delegates and events.

With C# Primer Plus's dual emphasis on C# as well as fundamental programming techniques, this friendly tutorial will soon make you a proficient C# programmer building Windows applications on the .NET platform.

Table of Contents

Introduction.
1. Computers and Computer Programming: Basic Concepts.

C# Is an Object-Oriented Programming Language. Hardware. Software. Summary. Review Questions.


2. Your First C# Program.

Software Development. The Software Development Process. Algorithms and Pseudocode. The Three Different Types of Errors. Object-Oriented Programming: A First Encounter. Software Reuse. The Assembly, the Basic Unit of Code Reuse in .NET. The .NET Framework Class Library. C#: History and Design Goals. C#'s Background. C#'s Design Goals. What Kind of Programs Can I Write with C#? The Mechanics of Creating a C# Program. Before Getting Started. Choosing a Text Editor. The Seven Steps to Writing a Simple C# Program. A Brief Source Code Analysis. Note on Syntax Errors and Compilers. Summary. Review Questions. Programming Exercises.


3. A Guided Tour through C#: Part I.

Introduction. Abstraction and Encapsulation. An Interactive Hello World! Program. Summary. Review Questions. Programming Exercises.


4. A Guided Tour through C#: Part II.

Introduction. Essential Elements of SimpleCalculator.cs. Simplifying Your Code with Methods. Methods as Building Blocks: Encapsulating Your Helper Methods with the private keyword. Summary. Review Questions. Programming Exercises.


5. Your First Object-Oriented C# Program.

Introduction. Lexical Structure. Some Thoughts on Elevator Simulations. Concepts, Goals and Solutions in an Elevator Simulation Program: Collecting Valuable Statistics for Evaluating an Elevator System. Object-Oriented Programming: A Practical Example. Summary. Review Questions. Programming Exercises.


6. Types Part I: The Simple Types.

Introduction. Types in C#: An Overview. Simple Types. The Blipos Clock. Summary. Review Questions. Programming Exercises.


7. Types Part II: Operators, Enumerators, and Strings.

Introduction. Arithmetic Operators and Numerical Expressions. Associativity. Parentheses and Precedence. The Modulus Operator (%). Unary Operators. Determining the Type of an Expression. Combining Different Types in One Expression. Accessing the Metadata of a Component: A Brief Introduction. Enumerated Constants. Enumerator Operators. Conversions. The Methods of System.Enum. Characters and Text. The char Type. The string type. Summary. Review Questions. Programming Exercises.


8. Flow of Control Part I: Branching Statements and Related Concepts.

Introduction to Flow of Control. Branching with the if Statement. Comparison Operators and Boolean Expressions. Nested if Statements. Multibranch if-else Statements. Logical Operators. The Scope of Variables. The goto Statement. The switch Statement. The Conditional Operator. Summary. Review Questions. Programming Exercises.


9. Flow of Control Part II: Iteration Statements.

Traversing, Analyzing, and Generating Sequences of Data. The while Loop Statement. The do-while Loop Statement. The for Loop Statement. The Jump Statements break and continue. Structured Programming and Structured Constructs. Combination Assignment Operators. Nested Iteration Statements. Programming Exercises. Summary. Review Questions. Programming Exercises.


10. Arrays Part I: Array Essentials.

Declaring and Defining an Array. Accessing Individual Array Elements. Array Indexes Out of Range. Adjusting for the Zero-Based Array Index. Initializing Arrays. Traversing an Entire Array with the foreach Statement. System.Array Is a Reference Type. Arrays and Equality. Arrays and Methods. A Method to Perform Array Value Equality Comparisons. Command Line Arguments. Using Arrays As Return Values from Methods. Array Elements Referencing Objects. Arrays As Instance Variables in Classes. Summary. Review Questions. Programming Exercises.


11. Arrays Part II: Multidimensional Arrays— Searching and Sorting Arrays.

Multidimensional Arrays. Arrays of More Than Two Dimensions. The Built-In Methods of System.Array. Special Array Techniques. Searching. Summary. Review Questions. Programming Exercises.


12. Class Anatomy Part I: static Class Members and Method Adventures.

The Anatomy of a Class: Overview. Data Members. Function Members. Summary. Review Questions. Programming Exercises.


13. Class Anatomy Part II: Object Creation and Garbage Collection.

Instance Constructors. static Constructors. The readonly Member. Garbage Collection: Automatic Dynamic Memory Management. Summary. Review Questions. Programming Exercises.


14. Class Anatomy Part III: Writing Intuitive Code.

Properties. Indexers: Using Objects Like Arrays. Operator Overloading. User-Defined Implicit and Explicit Conversions. Nested Types. Summary. Review Questions. Programming Exercises.


15. Namespaces, Compilation Units, and Assemblies.

Defining Your Own Namespaces. The Global Nameless Namespace. Namespaces and Compilation Units. Nested Namespaces. Namespace Syntax. More About the using Directive. Compile Units, Namespaces, and Assemblies. Exploring Assemblies with the Ildasm Utility. Summary. Review Questions. Programming Exercises.


16. Inheritance Part I: Basic Concepts.

The Need for Inheritance. Inheritance Fundamentals. Access Modifiers and Inheritance. Derived Class Constructors. Indexers Are Also Inherited and Can Be Overridden. Calling an Overridden Function in the Base Class. Reusing the .NET Framework Class Library with Inheritance. Multiple Levels of Derived Classes. Method Overriding and Overloading Are Different Mechanisms. Summary. Review Questions. Programming Exercises.


17. Inheritance Part II: abstract Functions, Polymorphism, and Interfaces.

abstract Methods, Properties, Indexers, and Classes. Polymorphism. Losing and Regaining Type Information. System.Object: The Ultimate Base Class. Summary. Review Questions. Programming Exercises.


18. Structs.

Defining a Struct. Boxing and Unboxing. Creating Structs with and without new. Value Types and Reference Types. Summary. Review Questions. Programming Exercises.


19. Exception Handling.

Exception Handling: A Brief Overview. Life without try-catch-finally. The try and catch blocks. Catching the Exception Object Farther up the Function Call Chain. Multiple catch Blocks. The finally Block. Nested try Block. throw: Explicitly Throwing Exceptions. Writing Custom Exceptions. Summary. Review Questions. Programming Exercises.


20. Delegates and Events.

Delegates. Events. Summary. Review Questions. Programming Exercises.


21. Preprocessing, XML Documentation, and Attributes.

Preprocessor Directives. XML Documentation. Attributes. Summary. Review Questions. Programming Exercises.


22. File I/O Basics.

The Need for Files. Stream Basics and File I/O. File I/O Classes: An Overview. The FileInfo Class. Text File Input and Output with StreamReader and StreamWriter. Binary Input and Output with the FileStream Class. Summary. Review Questions. Programming Exercises.


23. Recursion Fundamentals.

Pending Method Instances of Different Methods. Pending Method Instances of the Same Method. Putting Recursion to Work: Calculating n Factorial. Recursion and Iteration. Binary Search Using Recursion. Summary. Review Questions. Programming Exercises.


Appendix A: Answers to Quizzes and Exercises.
Index

商品描述(中文翻譯)

《C# Primer Plus》從基礎開始教授 C# 程式語言及 .NET 平台的相關部分,帶領您了解物件導向程式設計的基本概念、重要的程式設計技術和問題解決方法,同時全面涵蓋 C# 的基本要素,例如類別、物件、資料類型、迴圈、分支語句、陣列和命名空間。

在早期章節中,導覽將帶您參觀 C# 的主要特點,提供快速的學習路徑,使您能夠迅速編寫簡單的 C# 程式。您的初步程式設計技能將透過眾多範例、案例研究、插圖、複習問題和程式設計練習逐步擴展,涵蓋強大的概念,如繼承、多型、介面和例外處理,以及 C# 最具創新性的特性,如屬性、索引器、委派和事件。

透過《C# Primer Plus》對 C# 及基本程式設計技術的雙重重視,這本友好的教程將很快使您成為一名熟練的 C# 程式設計師,能夠在 .NET 平台上構建 Windows 應用程式。

目錄
引言。
1. 電腦與電腦程式設計:基本概念。
C# 是一種物件導向程式語言。硬體。軟體。總結。複習問題。

2. 您的第一個 C# 程式。
軟體開發。軟體開發過程。演算法與偽程式碼。三種不同類型的錯誤。物件導向程式設計:第一次接觸。軟體重用。組件,.NET 中程式碼重用的基本單位。.NET 框架類別庫。C#:歷史與設計目標。C# 的背景。C# 的設計目標。我可以用 C# 寫什麼樣的程式?創建 C# 程式的機制。在開始之前。選擇文本編輯器。編寫簡單 C# 程式的七個步驟。簡要的源代碼分析。關於語法錯誤和編譯器的說明。總結。複習問題。程式設計練習。

3. C# 導覽:第一部分。
引言。抽象與封裝。一個互動的 Hello World! 程式。總結。複習問題。程式設計練習。

4. C# 導覽:第二部分。
引言。SimpleCalculator.cs 的基本要素。使用方法簡化您的程式碼。方法作為構建塊:使用 private 關鍵字封裝您的輔助方法。總結。複習問題。程式設計練習。

5. 您的第一個物件導向 C# 程式。
引言。詞法結構。關於電梯模擬的一些想法。電梯模擬程式中的概念、目標和解決方案:收集評估電梯系統的有價值統計數據。物件導向程式設計:一個實用的範例。總結。複習問題。程式設計練習。

6. 類型第一部分:簡單類型。
引言。C# 中的類型:概述。簡單類型。Blipos 時鐘。總結。複習問題。程式設計練習。

7. 類型第二部分:運算子、列舉和字串。
引言。算術運算子和數值表達式。結合性。括號和優先順序。模運算子 (%)。一元運算子。確定表達式的類型。在一個表達式中結合不同類型。訪問組件的元數據:簡要介紹。列舉常數。列舉運算子。轉換。System.Enum 的方法。字元和文本。char 類型。string 類型。總結。複習問題。程式設計練習。

8. 控制流程第一部分:分支語句和相關概念。
控制流程介紹。使用 if 語句進行分支。比較運算子和布林表達式。巢狀 if 語句。多分支 if-else 語句。邏輯運算子。變數的範圍。goto 語句。switch 語句。條件運算子。總結。複習問題。程式設計練習。

9. 控制流程第二部分:迭代語句。
遍歷、分析和生成數據序列。while 迴圈語句。do-while 迴圈語句。for 迴圈語句。跳轉語句 break 和 continue。結構化程式設計和結構化構造。組合賦值運算子。巢狀迭代語句。程式設計練習。總結。複習問題。程式設計練習。

10. 陣列第一部分:陣列要素。
宣告和定義陣列。訪問單個陣列元素。陣列索引超出範圍。調整零基陣列索引。初始化陣列。使用 foreach 語句遍歷整個陣列。System.Array 是一種引用類型。陣列與相等性。陣列與方法。執行陣列值相等比較的方法。命令行參數。將陣列用作方法的返回值。陣列元素引用物件。陣列作為類別中的實例變數。總結。複習問題。程式設計練習。

11. 陣列第二部分:多維陣列—搜尋和排序陣列。
多維陣列。超過兩個維度的陣列。System.Array 的內建方法。特殊陣列技術。搜尋。總結。複習問題。程式設計練習。

12. 類別解剖第一部分:靜態類別成員和方法冒險。
類別的解剖:概述。資料成員。函數成員。總結。複習問題。程式設計練習。

13. 類別解剖第二部分:物件創建和垃圾回收。
實例建構函數。靜態建構函數。readonly 成員。垃圾回收:自動動態記憶體管理。總結。複習問題。程式設計練習。

14. 類別解剖第三部分:編寫直觀的程式碼。
屬性。索引器:像陣列一樣使用物件。運算子重載。使用者定義的隱式和顯式轉換。巢狀類型。總結。複習問題。程式設計練習。

15. 命名空間、編譯單元和組件。
定義您自己的命名空間。全局無名命名空間。命名空間和編譯單元。巢狀命名空間。命名空間語法。關於 using 指令的更多資訊。編譯單元、命名空間和組件。使用 Ildasm 工具探索組件。總結。複習問題。程式設計練習。

16. 繼承第一部分:基本概念。
繼承的必要性。繼承基礎。訪問修飾符和繼承。派生類別建構函數。索引器也會被繼承並可以被重寫。在基類中調用重寫的函數。使用繼承重用 .NET 框架類別庫。多層次的派生類別。方法重寫和重載是不同的機制。總結。複習問題。程式設計練習。

17. 繼承第二部分:抽象函數、多型和介面。
抽象方法、屬性、索引器和類別。多型。失去和恢復類型資訊。System.Object:終極基類。總結。複習問題。程式設計練習。

18. 結構。
定義結構。裝箱和拆箱。使用和不使用 new 創建結構。值類型和引用類型。總結。複習問題。程式設計練習。

19. 例外處理。
例外處理:簡要概述。沒有 try-catch-finally 的生活。try 和 catch 區塊。捕獲函數調用鏈中更高層的例外物件。多個 catch 區塊。finally 區塊。巢狀 try 區塊。throw:顯式拋出例外。編寫自定義例外。總結。複習問題。程式設計練習。

20. 委派和事件。
委派。事件。總結。複習問題。程式設計練習。

21. 預處理、XML 文檔和屬性。
預處理指令。XML 文檔。屬性。總結。複習問題。程式設計練習。

22. 檔案 I/O 基礎。
檔案的必要性。串流基礎和檔案 I/O。檔案 I/O 類別:概述。FileInfo 類別。使用 StreamReader 和 StreamWriter 進行文本檔案的輸入和輸出。使用 FileStream 類別進行二進位輸入和輸出。總結。複習問題。程式設計練習。

23. 遞迴基礎。
不同方法的待處理方法實例。同一方法的待處理方法實例。將遞迴付諸實踐:計算 n 的階乘。遞迴與迭代。使用遞迴的二元搜尋。總結。複習問題。程式設計練習。

附錄 A:測驗和練習的答案。索引