新书推荐 |《C# 7.0本质论(英文版)》
新书推荐
《C# 7.0本质论(英文版)》
世界级的C#专家经典畅销书!入门及进阶的进阶之作!涵盖最新的C# 7.0
编辑推荐
本书是经典畅销书,前几版广受好评;
作者是世界级的C#专家,长期的微软MVP和Regional Director;
微软C#项目经理鼎力推荐
涵盖最新的C# 7.0
内容简介
本书共22章。第1章是C#概述;第2章和第3章介绍C#中的数据类型;第4章讨论操作符和控制流;第5章探讨方法和参数;第6章讲解类,它是面向对象技术的核心;第7章介绍继承,其中包括继承语法的细节;第8章探讨接口;第9章和第10章分别介绍值类型和合式类型;第11章延伸讨论第5章引入的异常处理机制;第12章引入泛型;第13章讲解委托和Lambda表达式;第14章讨论事件;第15章介绍支持标准查询操作符的集合接口;第16章探讨使用查询表达式的LINQ;第17章讲解如何构建自定义集合;第18章介绍反射、特性和动态编程的方方面面;第19章涵盖多线程处理;第20章以第19章为基础,演示了线程同步的用法;第21章涵盖平台互操作性和不安全的代码;第22章讲解公共语言基础结构,并讨论C#程序与底层“运行时”及规范的关系。
作者简介
Mark Michaelis是高端软件工程和咨询公司IntelliTect的创办者、首席技术架构师和培训师。Mark经常在开发者大会上发言,写过许多文章和书籍,目前是《MSDN Magazine》的《Essential .NET》专栏作家。
序
本书是C#最权威、最值得尊重的参考书之一,作者为此付出了非凡的努力!Mark Michaelis的《Essential C#》系列多年来一直是畅销经典。而我刚认识Mark的时候,这本书还处于萌芽阶段。
2005年LINQ(语言集成查询,Language Integrated Query)公布时,我才刚加入微软公司,正好见证了PDC会议上令人激动的公开发布时刻。虽然我对技术本身几乎没有什么贡献,但它的宣传造势我可是全程参加了。那时人人都在谈论它,宣传小册子满天飞。那是C#和.NET的大日子,至今依然令人难忘。
但会场的实践实验室区域却相当安静,那儿的人可以按部就班地试验处于预览阶段的技术。我就是在那儿遇见Mark的。不用说,他一点儿都没有按部就班的意思。他在做自己的试验,梳理文档,和别人沟通,忙着鼓捣自己的东西。
作为C#社区的新人,我感觉自己在那次会议上见到了许多人。但老实说,当时太混乱了,我唯一记得清的就是Mark。因为当问他是否喜欢这个新技术时,他不像别人那样马上开始滔滔不绝,而是非常冷静地说:“还不确定,要自己搞一搞才知道。”他希望完整地理解并消化一种技术,之后才将自己的想法告知于人。
所以我们之间没像我本来设想的那样发生一次快餐式的对话。相反,我们的对话相当坦诚、颇有营养。像这样的交流好多年都没有过了。新技术的细节、造成的后果和存在的问题全都涉及了。对我们这些语言设计者而言,Mark是最有价值的社区成员。他非常聪明,善于打破砂锅问到底,能深刻理解一种技术对于真正的开发人员的影响。但是,最根本的原因可能还是他坦诚,他从不惧怕说出自己的想法。一样东西通过了Mark的测试,就没什么好担心的了!
这些特质也使Mark成为一名出色的作家。他的文字直指技术的本质,敏锐地指出技术的真正价值和问题,向读者提供最完整的信息且没有废话。没人能像这位大师一样帮你正确理解C# 7.0。
请好好享用本书!
——Mads Torgersen,微软公司C#项目经理
目录
第1章 C#概述 1
1.1 Hello, World 2
1.2 C#语法基础 11
1.3 使用变量 20
1.4 控制台输入和输出 24
1.5 注释 28
1.6 托管执行和CLI 32
1.7 多个.NET框架 37
第2章 数据类型 43
2.1 基本数值类型 44
2.2 更多基本类型 53
2.3 null和void 67
2.4 数据类型转换 69
第3章 更多数据类型 77
3.1 类型的划分 77
3.2 可空修饰符 80
3.3 元组 83
3.4 数组 90
第4章 操作符和控制流程 109
4.1 操作符 110
4.2 控制流程概述 126
4.3 代码块 132
4.4 代码块、作用域和声明空间 135
4.5 布尔表达式 137
4.6 按位操作符 147
4.7 控制流程语句(续) 153
4.8 跳转语句 165
4.9 C#预处理器指令 171
第5章 方法和参数 181
5.1 调用方法 182
5.2 声明方法 189
5.3 using指令 195
5.4 Main()的返回值和参数 200
5.5 高级方法参数 203
5.6 递归 215
5.7 方法重载 217
5.8 可选参数 220
5.9 用异常实现基本错误处理 225
第6章 类 241
6.1 类的声明和实例化 245
6.2 实例字段 249
6.3 实例方法 251
6.4 使用this关键字 252
6.5 访问修饰符 259
6.6 属性 261
6.7 构造函数 278
6.8 静态成员 289
6.9 扩展方法 299
6.10 封装数据 301
6.11 嵌套类 304
6.12 分部类 307
第7章 继承 313
7.1 派生 314
7.2 重写基类 326
7.3 抽象类 338
7.4 所有类都从System.Object派生 344
7.5 使用is操作符验证基础类型 345
7.6 使用is操作符进行模式匹配 346
7.7 switch语句中的模式匹配 347
7.8 使用as操作符进行转换 349
第8章 接口 353
8.1 接口概述 354
8.2 通过接口实现多态性 355
8.3 接口实现 360
8.4 在实现类和接口之间转换 366
8.5 接口继承 366
8.6 多接口继承 369
8.7 接口上的扩展方法 369
8.8 通过接口实现多继承 371
8.9 版本控制 374
8.10 比较接口和类 375
8.11 比较接口和特性 377
第9章 值类型 379
9.1 结构 383
9.2 装箱 390
9.3 枚举 398
第10章 合式类型 411
10.1 重写object的成员 411
10.2 操作符重载 424
10.3 引用其他程序集 432
10.4 定义命名空间 442
10.5 XML注释 445
10.6 垃圾回收 449
10.7 资源清理 452
10.8 推迟初始化 461
第11章 异常处理 465
11.1 多异常类型 465
11.2 捕捉异常 469
11.3 常规catch块 473
11.4 异常处理规范 475
11.5 自定义异常 479
11.6 重新抛出包装的异常 483
第12章 泛型 487
12.1 如果C#没有泛型 488
12.2 泛型类型概述 493
12.3 约束 506
12.4 泛型方法 519
12.5 协变性和逆变性 524
12.6 泛型的内部机制 531
第13章 委托和Lambda表达式 537
13.1 委托概述 538
13.2 声明委托类型 542
13.3 Lambda表达式 550
13.4 匿名方法 556
第14章 事件 575
14.1 使用多播委托编码Publish-Subscribe模式 576
14.2 理解事件 591
第15章 支持标准查询操作符的集合接口 603
15.1 集合初始化器 604
15.2 IEnumerable<T>使类成为集合 607
15.3 标准查询操作符 613
15.4 匿名类型之于LINQ 646
第16章 使用查询表达式的LINQ 657
16.1 查询表达式概述 658
16.2 查询表达式只是方法调用 676
第17章 构建自定义集合 679
17.1 更多集合接口 680
17.2 主要集合类 683
17.3 提供索引器 702
17.4 返回null或者空集合 705
17.5 迭代器 705
第18章 反射、特性和动态编程 721
18.1 反射 722
18.2 特性 735
18.3 使用动态对象进行编程 759
第19章 多线程处理 771
19.1 多线程处理基础 774
19.2 使用System.Threading 781
19.3 异步任务 789
19.4 取消任务 810
19.5 基于任务的异步模式 816
19.6 并行迭代 846
19.7 并行执行LINQ查询 856
第20章 线程同步 863
20.1 线程同步的意义 864
20.2 计时器 893
第21章 平台互操作性和不安全代码 897
21.1 平台调用 898
21.2 指针和地址 910
21.3 通过委托执行不安全代码 920
第22章 公共语言基础结构(CLI) 923
22.1 CLI的定义 924
22.2 CLI的实现 925
22.3 .NET标准 928
22.4 BCL 929
22.5 C#编译成机器码 929
22.6 运行时 932
22.7 程序集、清单和模块 936
22.8 公共中间语言 939
22.9 公共类型系统 939
22.10 公共语言规范 940
22.11 元数据 941
22.12 NET Native和AOT编译 942
Contents
1 Introducing C# 1
Hello, World 2
C# Syntax Fundamentals 11
Working with Variables 20
Console Input and Output 24
Commne ts 28
Managed Execution and the Common Language Infrastructure 32
Multiple .NET Frameworks 37
2 Data Types 43Fundamental Numeric Types 44
More Fundamental Types 53
null and void 67
Conversions between Data Types 69
3 More with Data Types 77
Categories of Types 77
Nullable Modifier 80
Tuples 83
Arrays 90
4 Operators and Control Flow 109
Operators 110
Introducing Flow Control 126
Code Blocks ({}) 132
Code Blocks, Scopes, and Declaration Spaces 135
Boolean Expressions 137
Bitwise Operators (<<, >>, |, &, ^, ~) 147
Control Flow Statements, Continued 153
Jump Statements 165
C# Preprocessor Directives 171
5 Methods and Parameters 181
Calling a Method 182
Declaring a Method 189
The using Directive 195
Returns and Parameters on Main() 200
Advanced Method Parameters 203
Recursion 215
Method Overloading 217
Optional Parameters 220
Basic Error Handling with Exceptions 225
6 Classes 241
Declaring and Instantiating a Class 245
Instance Fields 249
Instance Methods 251
Using the this Keyword 252
Access Modifiers 259
Properties 261
Constructors 278
Static Members 289
Extension Methods 299
Encapsulating the Data 301
Nested Classes 304
Partial Classes 307
7 Inheritance 313
Derivation 314
Overriding the Base Class 326
Abstract Classes 338
All Classes Derive from System.Object 344
Verifying the Underlying Type with the is Operator 345
Pattern Matching with the is Operator 346
Pattern Matching within a switch Statement 347
Conversion Using the as Operator 349
8 Interfaces 353
Introducing Interfaces 354
Polymorphism through Interfaces 355
Interface Implementation 360
Converting between the Implementing Class and Its Interfaces 366
Interface Inheritance 366
Multiple Interface Inheritance 369
Extension Methods on Interfaces 369
Implementing Multiple Inheritance via Interfaces 371
Versioning 374
Interfaces Compared with Classes 375
Interfaces Compared with Attributes 377
9 Value Types 379
Structs 383
Boxing 390
Enums 398
10 Well-Formed Types 411
Overriding object Members 411
Operator Overloading 424
Referencing Other Assemblies 432
Defining Namespaces 442
XML Comments 445
Garbage Collection 449
Resource Cleanup 452
Lazy Initialization 461
11 Exception Handling 465
Multiple Exception Types 465
Catching Exceptions 469
General Catch Block 473
Guidelines for Exception Handling 475
Defining Custom Exceptions 479
Rethrowing a Wrapped Exception 483
12 Generics 487
C# without Generics 488
Introducing Generic Types 493
Constraints 506
Generic Methods 519
Covariance and Contravariance 524
Generic Internals 531
13 Delegates and Lambda Expressions 537
Introducing Delegates 538
Declaring Delegate Types 542
Lambda Expressions 550
Anonymous Methods 556
14 Events 575
Coding the Publish-Subscribe Pattern with Multicast Delegates 576
Understanding Events 591
15 Collection Interfaces with Standard Query Operators 603
Collection Initializers 604
What Makes a Class a Collection: IEnumerable<T> 607
Standard Query Operators 613
Anonymous Types with LINQ 646
16 LINQ with Query Expressions 657
Introducing Query Expressions 658
Query Expressions Are Just Method Invocations 676
17 Building Custom Collections 679
More Collection Interfaces 680
Primary Collection Classes 683
Providing an Indexer 702
Returning Null or an Empty Collection 705
Iterators 705
18 Reflection, Attributes, and Dynamic Programming 721
Reflection 722
Attributes 735
Programming with Dynamic Objects 759
19 Multithreading 771
Multithreading Basics 774
Working with System.Threading 781
Asynchronous Tasks 789
Canceling a Task 810
The Task-based Asynchronous Pattern 816
Executing Loop Iterations in Parallel 846
Running LINQ Queries in Parallel 856
20 Thread Synchronization 863
Why Synchronization? 864
Timers 893
21 Platform Interoperability and Unsafe Code 897
Platform Invoke 898
Pointers and Addresses 910
Executing Unsafe Code via a Delegate 920
22 The Common Language Infrastructure 923
Defining the Common Language Infrastructure 924
CLI Implementations 925
.NET Standard 928
Base Class Library 929
C# Compilation to Machine Code 929
Runtime 932
Assemblies, Manifests, and Modules 936
Common Intermediate Language 939
Common Type System 939
Common Language Specification 940
Metadata 941
.NET Native and Ahead of Time Compilation 942
~活动~
试读章节写书评赢取赠书
点击“阅读原文”登陆《C# 7.0本质论(英文版)》试读页面,试读章节后写下本书对你的帮助或启发,字数不得少于50字;即有机会获得赠书一本,共5本。
你与世界
只差一个
公众号
戳“阅读原文”一起来了解吧!