Skip to Content
C# 12 核心要点
book

C# 12 核心要点

by Joseph Albahari
May 2025
Intermediate to advanced
1086 pages
14h 54m
Chinese
O'Reilly Media, Inc.
Content preview from C# 12 核心要点

序言

本作品已使用人工智能进行翻译。欢迎您提供反馈和意见:translation-feedback@oreilly.com

C# 12 是微软旗舰编程语言的第九次重大更新,它将 C# 定位为一种具有非凡灵活性和广度的语言。一方面,它提供查询表达式和异步连续等高级抽象,另一方面,它通过自定义值类型和可选指针等结构实现了低级效率。

这种增长的代价是需要学习的东西比以往任何时候都多。尽管微软的 IntelliSense 等工具和在线参考资料在帮助您工作方面非常出色,但它们都假定您已有概念知识图谱。本书正是以简洁统一的风格提供了这种知识地图,没有杂乱无章的冗长介绍。

与过去的七个版本一样,《C# 12 简明教程》也是围绕概念和用例编排的,因此既适合按顺序阅读,也适合随意浏览。此外,该书在深入探讨大量内容的同时,仅假定读者具备基本的背景知识,因此中高级读者均可阅读。

本书涵盖 C#、通用语言运行时 (CLR) 和 .NET 8 基类库 (BCL)。我们选择了这样的重点,以便在不影响深度和可读性的前提下,为困难和高级主题留出空间。书中标注了 C# 最近添加的功能,因此您也可以将本书作为 C# 11 和 C# 10 的参考书。

预期受众

本书面向中高级读者。读者无需事先了解 C#,但需要具备一定的编程经验。对于初学者来说,本书是对教程式编程入门的补充,而不是替代。

本书是任何一本专注于 ASP.NET Core 或 Windows Presentation Foundation (WPF) 等应用技术的大量书籍的理想伴侣。C# 12 in a Nutshell》涵盖了这类书籍忽略的语言和.NET领域,反之亦然。

如果你正在寻找一本对所有.NET技术都略知一二的书,那么这本书并不适合你。如果你想了解移动设备开发专用的 API,这本书也不适合你。

本书的编排方式

第 2 章到 第 4 章完全集中在 C# 上,从语法、类型和变量等基础知识开始,到不安全代码和预处理器指令等高级主题结束。如果你是语言新手,应该按顺序阅读这些章节。

其余各章的重点是.NET 8的基础类库,涉及语言集成查询(LINQ)、XML、集合、并发、I/O和Network+、内存管理、反射、动态编程、属性、密码学和本地互操作性等主题。除了为后续主题奠定基础的第 5章和第 6 章外,其他大部分章节都可以随意阅读。您最好还能依次阅读有关 LINQ 的三章内容,其中有些章节假定您具备并发知识,我们将在第 14 章介绍并发知识。

使用本书所需的材料

本书中的示例需要使用 .NET 8。您还会发现微软的 .NET 文档对查找个别类型和成员非常有用(可在线获取)。

虽然可以使用简单的文本编辑器编写源代码,并通过命令行构建程序,但使用代码抓板即时测试代码片段,以及集成开发环境(IDE)制作可执行文件和程序库,会让你的工作效率大大提高。

如需 Windows 代码划板,请从www.linqpad.net下载 LINQPad 8(免费)。LINQPad 完全支持 C# 12,并由作者维护。

如需 Windows 集成开发环境,请下载Visual Studio 2022:任何版本都适合本书所讲授的内容。如需跨平台集成开发环境,请下载Visual Studio Code

备注

所有章节的所有代码列表均以交互式(可编辑)LINQPad 示例的形式提供。你可以一键下载全部内容:在左下角,点击 LINQPad 的示例选项卡,点击 "下载更多示例",然后选择 "C# 12 in a Nutshell"。

本书使用的约定 ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Programming C# 12

Programming C# 12

Ian Griffiths
C# 12 in a Nutshell

C# 12 in a Nutshell

Joseph Albahari
C# 6 for Programmers, Sixth Edition

C# 6 for Programmers, Sixth Edition

Paul Deitel, Harvey Deitel
Head First C#, 4th Edition

Head First C#, 4th Edition

Andrew Stellman, Jennifer Greene

Publisher Resources

ISBN: 9798341657038