Programming C# 8.0: Build Windows, Web, and Desktop Applications (Paperback)

Ian Griffiths

  • 出版商: O'Reilly
  • 出版日期: 2020-01-14
  • 售價: $2,500
  • 貴賓價: 9.5$2,375
  • 語言: 英文
  • 頁數: 800
  • 裝訂: Paperback
  • ISBN: 1492056812
  • ISBN-13: 9781492056812
  • 相關分類: C#
  • 已絕版

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

相關主題

商品描述

C# is undeniably one of the most versatile programming languages available to engineers today. With this comprehensive guide, you'll learn just how powerful the combination of C# and .NET can be. Author Ian Griffiths guides you through C# 8.0 fundamentals and teaches you techniques for building web and desktop applications.

Designed for experienced programmers, this book provides many code examples to help you work with the nuts and bolts of C# code, such as generics, dynamic typing, nullable reference types, and asynchronous programming features. You'll also get up to speed on ASP.NET, LINQ, and other .NET tools.

商品描述(中文翻譯)

C# 無疑是當今工程師中最多功能的程式語言之一。這本全面的指南將向您展示 C# 和 .NET 的組合有多麼強大。作者 Ian Griffiths 將引導您學習 C# 8.0 的基礎知識,並教授您構建網頁和桌面應用程式的技巧。

這本書專為有經驗的程式設計師設計,提供了許多程式碼示例,幫助您處理 C# 程式碼的細節,例如泛型、動態類型、可為空的參考類型和非同步程式設計功能。您還將快速掌握 ASP.NET、LINQ 和其他 .NET 工具。

作者簡介

Ian Griffiths is a C# and WPF instructor with Pluralsight, the coauthor of Programming WPF (O'Reilly Media), and a widely recognized expert on the subject. Ian is a Technical Fellow at technology consultancy firm Endjin. He holds a degree in Computer Science from Cambridge University.

作者簡介(中文翻譯)

Ian Griffiths 是 Pluralsight 的 C# 和 WPF 講師,也是《Programming WPF》(O'Reilly Media)的合著者,被廣泛認可為該領域的專家。Ian 是技術顧問公司 Endjin 的技術總監。他擁有劍橋大學的計算機科學學位。

目錄大綱

How to Contact Us
Acknowledgments
1. Introducing C#
Why C#?
C#’s Defining Features
Managed Code and the CLR
Prefer Generality to Specialization
C# Standards and Implementations
Many Microsoft .NETs (Temporarily)
Targeting Multiple .NET Versions with .NET Standard
Visual Studio and Visual Studio Code
Anatomy of a Simple Program
Adding a Project to an Existing Solution
Referencing One Project from Another
Referencing External Libraries
Writing a Unit Test
Namespaces
Classes
Program Entry Point
Unit Tests
Summary

2. Basic Coding in C#
Local Variables
Scope
Statements and Expressions
Statements
Expressions
Comments and Whitespace
Preprocessing Directives
Compilation Symbols
#error and #warning
#line
#pragma
#nullable
#region and #endregion
Fundamental Data Types
Numeric Types
Booleans
Strings and Characters
Tuples
Dynamic
Object
Operators
Flow Control
Boolean Decisions with if Statements
Multiple Choice with switch Statements
Loops: while and do
C-Style for Loops
Collection Iteration with foreach Loops
Patterns
Getting More Specific with when
Patterns in Expressions
Summary

3. Types
Classes
Static Members
Static Classes
Reference Types
Structs
When to Write a Value Type
Guaranteeing Immutability
Members
Fields
Constructors
Deconstructors
Methods
Properties
Indexers
Initializer Syntax
Operators
Events
Nested Types
Interfaces
Default Interface Implementation
Enums
Other Types
Anonymous Types
Partial Types and Methods
Summary

4. Generics
Generic Types
Constraints
Type Constraints
Reference Type Constraints
Value Type Constraints
Value Types All the Way Down with Unmanaged Constraints
Not Null Constraints
Other Special Type Constraints
Multiple Constraints
Zero-Like Values
Generic Methods
Type Inference
Generics and Tuples
Inside Generics
Summary

5. Collections
Arrays
Array Initialization
Searching and Sorting
Multidimensional Arrays
Copying and Resizing
List<T>
List and Sequence Interfaces
Implementing Lists and Sequences
Implementing IEnumerable<T> with Iterators
Collection<T>
ReadOnlyCollection<T>
Addressing Elements with Index and Range Syntax
System.Index
System.Range
Supporting Index and Range in Your Own Types
Dictionaries
Sorted Dictionaries
Sets
Queues and Stacks
Linked Lists
Concurrent Collections
Immutable Collections
ImmutableArray<T>
Summary

6. Inheritance
Inheritance and Conversions
Interface Inheritance
Generics
Covariance and Contravariance
System.Object
The Ubiquitous Methods of System.Object
Accessibility and Inheritance
Virtual Methods
Abstract Methods
Inheritance and Library Versioning
Sealed Methods and Classes
Accessing Base Members
Inheritance and Construction
Special Base Types
Summary

7. Object Lifetime
Garbage Collection
Determining Reachability
Accidentally Defeating the Garbage Collector
Weak References
Reclaiming Memory
Garbage Collector Modes
Temporarily Suspending Garbage Collections
Accidentally Defeating Compaction
Forcing Garbage Collections
Destructors and Finalization
IDisposable
Optional Disposal
Boxing
Boxing Nullable<T>
Summary

8. Exceptions
Exception Sources
Exceptions from APIs
Failures Detected by the Runtime
Handling Exceptions
Exception Objects
Multiple catch Blocks
Exception Filters
Nested try Blocks
finally Blocks
Throwing Exceptions
Rethrowing Exceptions
Failing Fast
Exception Types
Custom Exceptions
Unhandled Exceptions
Summary

9. Delegates, Lambdas, and Events
Delegate Types
Creating a Delegate
Multicast Delegates
Invoking a Delegate
Common Delegate Types
Type Compatibility
Behind the Syntax
Anonymous Functions
Captured Variables
Lambdas and Expression Trees
Events
Standard Event Delegate Pattern
Custom Add and Remove Methods
Events and the Garbage Collector
Events Versus Delegates
Delegates Versus Interfaces
Summary

10. LINQ
Query Expressions
How Query Expressions Expand
Supporting Query Expressions
Deferred Evaluation
LINQ, Generics, and IQueryable<T>
Standard LINQ Operators
Filtering
Select
SelectMany
Ordering
Containment Tests
Specific Items and Subranges
Aggregation
Set Operations
Whole-Sequence, Order-Preserving Operations
Grouping
Joins
Conversion
Sequence Generation
Other LINQ Implementations
Entity Framework
Parallel LINQ (PLINQ)
LINQ to XML
Reactive Extensions
Tx (LINQ to Logs and Traces)
Summary

11. Reactive Extensions
Fundamental Interfaces
IObserver<T>
IObservable<T>
Publishing and Subscribing with Delegates
Creating an Observable Source with Delegates
Subscribing to an Observable Source with Delegates
Sequence Builders
Empty
Never
Return
Throw
Range
Repeat
Generate
LINQ Queries
Grouping Operators
Join Operators
SelectMany Operator
Aggregation and Other Single-Value Operators
Concat Operator
Rx Query Operators
Merge
Windowing Operators
The Scan Operator
The Amb Operator
DistinctUntilChanged
Schedulers
Specifying Schedulers
Built-in Schedulers
Subjects
Subject<T>
BehaviorSubject<T>
ReplaySubject<T>
AsyncSubject<T>
Adaptation
IEnumerable<T> and IAsyncEnumerable<T>
.NET Events
Asynchronous APIs
Timed Operations
Interval
Timer
Timestamp
TimeInterval
Throttle
Sample
Timeout
Windowing Operators
Delay
DelaySubscription
Summary

12. Assemblies
Anatomy of an Assembly
.NET Metadata
Resources
Multifile Assemblies
Other PE Features
Type Identity
Loading Assemblies
Assembly Resolution
Explicit Loading
Isolation and Plugins with AssemblyLoadContext
Assembly Names
Strong Names
Version
Culture
Protection
Summary

13. Reflection
Reflection Types
Assembly
Module
MemberInfo
Type and TypeInfo
MethodBase, ConstructorInfo, and MethodInfo
ParameterInfo
FieldInfo
PropertyInfo
EventInfo
Reflection Contexts
Summary

14. Attributes
Applying Attributes
Attribute Targets
Compiler-Handled Attributes
CLR-Handled Attributes
Defining and Consuming Attributes
Attribute Types
Retrieving Attributes
Summary

15. Files and Streams
The Stream Class
Position and Seeking
Flushing
Copying
Length
Disposal
Asynchronous Operation
Concrete Stream Types
One Type, Many Behaviors
Text-Oriented Types
TextReader and TextWriter
Concrete Reader and Writer Types
Encoding
Files and Directories
FileStream Class
File Class
Directory Class
Path Class
FileInfo, DirectoryInfo, and FileSystemInfo
Known Folders
Serialization
BinaryReader, BinaryWriter, and BinaryPrimitives
CLR Serialization
JSON.NET
Summary

16. Multithreading
Threads
Threads, Variables, and Shared State
The Thread Class
The Thread Pool
Thread Affinity and SynchronizationContext
Synchronization
Monitors and the lock Keyword
SpinLock
Reader/Writer Locks
Event Objects
Barrier
CountdownEvent
Semaphores
Mutex
Interlocked
Lazy Initialization
Other Class Library Concurrency Support
Tasks
The Task and Task<T> Classes
Continuations
Schedulers
Error Handling
Custom Threadless Tasks
Parent/Child Relationships
Composite Tasks
Other Asynchronous Patterns
Cancellation
Parallelism
The Parallel Class
Parallel LINQ
TPL Dataflow
Summary

17. Asynchronous Language Features
Asynchronous Keywords: async and await
Execution and Synchronization Contexts
Multiple Operations and Loops
Returning a Task
Applying async to Nested Methods
The await Pattern
Error Handling
Validating Arguments
Singular and Multiple Exceptions
Concurrent Operations and Missed Exceptions
Summary

18. Memory Efficiency
(Don’t) Copy That
Representing Sequential Elements with Span<T>
Utility Methods
Stack Only
Representing Sequential Elements with Memory<T>
ReadOnlySequence<T>
Processing Data Streams with Pipelines
Processing JSON in ASP.NET Core
Summary
Index

目錄大綱(中文翻譯)

如何聯繫我們

致謝

1. C#介紹

為什麼選擇C#?

C#的特點

受控代碼和CLR

偏好通用性而非特殊性

C#的標準和實現

許多Microsoft .NET(暫時)

使用.NET Standard針對多個.NET版本

Visual Studio和Visual Studio Code

簡單程式的結構

將專案添加到現有解決方案

引用其他專案

引用外部庫

撰寫單元測試

命名空間

類別

程式進入點

單元測試

摘要

2. C#基本編碼

區域變數

作用範圍

語句和表達式

語句

表達式

註釋和空白

預處理指令

編譯符號

#error和#warning

#line

#pragma

#nullable

#region和#endregion

基本數據類型

數值類型

布林值

字串和字符

元組

動態類型

物件

運算符

流程控制

使用if語句進行布林判斷

使用switch語句進行多選擇

循環:while和do

C風格的for循環

使用foreach循環遍歷集合

模式

使用when進行更具體的判斷

表達式中的模式

摘要

3. 類型

類別

靜態成員

靜態類別

引用類型

結構

何時使用值類型

保證不可變性

成員

字段

建構函式

解構函式

方法

屬性

索引子

初始化語法

運算符

事件

嵌套類型

介面

預設介面實現

列舉

其他類型

匿名類型

部分類型和方法

摘要

4. 泛型

泛型類型

約束

類型約束

引用類型約束

值類型約束

使用Unmanaged約束實現全程值類型

非空約束

其他特殊類型約束

多個約束

類似零的值

泛型方法

類型推斷

泛型和元組

泛型內部

摘要

5. 集合

陣列

陣列初始化

搜尋和排序

多維陣列

複製和調整大小

List<T>

List和序列介面

實現列表和序列

使用迭代器實現IEnumerable<T>

Collection<T>

ReadOnlyCollection<T>

使用索引和範圍語法訪問元素

System.Index

System.Range

在自己的類型中支援索引和範圍

字典

排序字典

集合

佇列和堆疊

鏈結串列

並行集合

不可變集合

ImmutableArray<T>

摘要

6. 繼承

繼承和轉換

介面繼承

泛型

協變和逆變

System.Object

System.Object的普遍方法

可訪問性和繼承

虛擬方法

抽象方法

繼承和庫版本控制

密封方法和類別

訪問基底成員

繼承和建構

特殊基底類型

摘要

7. 物件生命週期

垃圾回收

確定可達性

意外破壞垃圾回收器

弱引用

回收記憶體

垃圾回收器模式

暫時暫停垃圾回收

意外破壞壓縮

強制垃圾回收

D```