本站支持尊重有效期内的版权/著作权,所有的资源均来自于互联网网友分享或网盘资源,一旦发现资源涉及侵权,将立即删除。希望所有用户一同监督并反馈问题,如有侵权请联系站长或发送邮件到ebook666@outlook.com,本站将立马改正
9787111618980
基本信息
作者: [美] 马克·米凯利斯(Mark Michaelis)
丛书名: 经典原版书库
出版社:机械工业出版社
ISBN:9787111618980
上架时间:2019-3-1
出版日期:2019 年2月
开本:16开
页码:966
版次:1-1
所属分类:
内容简介
作为历年来深受各层次开发人员欢迎的C#**指南,本书讨论了从C# 3.0到7.0的*重要的C#特性,强调了现代编程模式,可帮助读者编写简洁、强大、健壮、安全和易于维护的C#代码。***C#专家Mark Michaelis对语言进行了全面而深入的探讨,提供了对关键C# 7.0增强、C# 7.0和.NET Core/.NET Standard的配合使用以及跨平台编译的专业论述。
作译者
第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使类成为集合
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 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