C# 6.0与.NET 4.6框架:第七版精华

需积分: 10 5 下载量 57 浏览量 更新于2024-07-20 收藏 16.34MB PDF 举报
"C# 6.0 and the .NET 4.6 Framework" 是一本由 Andrew Troelsen 和 Philip Japikse 合著的经典C#学习资料,详细介绍了C# 6.0语言特性和.NET Framework 4.6的相关内容。 这本书深入探讨了C#编程语言的最新版本C# 6.0,它引入了许多增强和优化,以提高开发人员的生产力和代码的可读性。在C# 6.0中,主要的更新包括: 1. **Null条件操作符**:?. 这个新操作符允许更安全地访问可能为null的对象成员,如果对象为null,则返回null,而不是引发NullReferenceException。 2. **字符串插值**:使用 `$` 符号前缀的字符串字面量,使得在字符串中插入变量变得更加简洁和直观。 3. **异步Main方法**:在C# 6.0中,允许在控制台应用程序的Main方法中使用async关键字,使得异步编程成为应用程序启动的一部分。 4. **表达式-bodied成员**:对于方法、属性和访问器,可以使用简洁的lambda表达式形式定义其主体,使代码更加紧凑。 5. **自动属性初始化器**:允许在声明属性时直接提供默认值,简化了类的定义。 6. **using指令的改进**:引入了using静态导入,可以直接引用静态类的成员,而无需实例化该类。 7. **字面量改进**:支持定义自定义的二进制和 Guid 字面量。 8. **属性的get-only设置器**:可以在构造函数外部定义只读属性的初始值。 9. **动态编译优化**:Roslyn编译器提供了更好的编译时分析和优化,提高了代码性能。 另一方面,.NET Framework 4.6是微软.NET平台的一个重大版本,它带来了许多性能提升和新特性,如: 1. **ASP.NET vNext**(后来称为ASP.NET Core):这是一个跨平台、模块化的框架,用于构建高性能的Web应用。 2. **WCF更新**:增强了Windows Communication Foundation(WCF)服务的安全性和性能。 3. **数据库支持增强**:Entity Framework 6.1的改进,包括更好的代码优先开发体验和对异步操作的支持。 4. **安全性改进**:例如,支持TLS 1.2协议,增强了网络通信的安全性。 5. **性能优化**:对基础库进行了优化,包括更快的垃圾回收和更好的内存管理。 6. **桌面应用支持**:对Windows Forms和WPF应用的改进,提供了更好的触控和高DPI支持。 7. **TypeForwarding增强**:使得库的升级更加平滑,即使旧版本的引用库没有更新,也能正确地指向新版本的实现。 8. **BCL(基类库)扩展**:新增了一些类库,提供了更多用于开发的功能。 这本书详细解释了这些新特性的用法和背后的原理,对于希望深入了解C# 6.0和.NET Framework 4.6的开发者来说,是一份不可多得的参考资源。通过阅读本书,读者不仅可以学习到最新的语言特性和框架功能,还能提升自己的编程技巧和解决问题的能力。
2015-12-04 上传
Paperback: 1625 pages Publisher: Apress; 7th ed. 2015 edition (January 1, 2016) Language: English ISBN-10: 1484213335 ISBN-13: 978-1484213339 This new 7th edition of Pro C# 6.0 and the .NET 4.6 Platform has been completely revised and rewritten to reflect the latest changes to the C# language specification and new advances in the .NET Framework. You'll find new chapters covering all the important new features that make .NET 4.6 the most comprehensive release yet, including: A Refined ADO.NET Entity Framework Programming Model Numerous IDE and MVVM Enhancements for WPF Desktop Development Numerous updates to the ASP.NET Web APIs This comes on top of award winning coverage of core C# features, both old and new, that have made the previous editions of this book so popular. Readers will gain a solid foundation of object-oriented development techniques, attributes and reflection, generics and collections as well as numerous advanced topics not found in other texts (such as CIL opcodes and emitting dynamic assemblies). The mission of this book is to provide you with a comprehensive foundation in the C# programming language and the core aspects of the .NET platform plus overviews of technologies built on top of C# and .NET (ADO.NET and Entity Framework, Windows Communication Foundation (WCF), Windows Presentation Foundation (WPF), ASP.NET (WebForms, MVC, WebAPI).). Once you digest the information presented in these chapters, you’ll be in a perfect position to apply this knowledge to your specific programming assignments, and you’ll be well equipped to explore the .NET universe on your own terms. What you’ll learn Be the first to understand the .NET 4.6 platform and C# 6. Discover the ins and outs of the leading .NET technology. Learn from an award-winning author who has been teaching the .NET world since version 1.0. Find complete coverage of XAML, .NET 4.6 and Visual Studio 2015 together with discussion of the new Windows Runtime. Who this book is for This book is perfect for anyone who is interested in the new .NET Framework 4.6 and the C# language. Whether you are moving to .NET for the first time or are already writing applications using previous .NET versions, this book will provide you with a comprehensive grounding in the new technology and serve as a complete reference throughout your coding career.
2016-01-15 上传
The first edition of this book was released in 2001 at the same time Microsoft released the Beta 2 build of .NET 1.0. Working on that first edition was certainly a challenge, given that the APIs and C# language were in a bit of flux during the authoring process. At that time, the entirety of the .NET platform was quite manageable from a developer’s point of view. Windows Forms was the only desktop GUI API option in the platform, ASP.NET was exclusively focused on the web-form programming model, and C# was a lean and mean OOP. Throughout the first six editions of this text, I have been the sole author responsible for updating the book to account for the numerous changes to the C# language and new APIs in the .NET platform. This book has been updated over the last 14 years to account for the Language Integrated Query (LINQ) programming model, Windows Presentation Foundation (WPF), Windows Communication Foundation (WCF), new threading models and keywords, new development tools, and changes to the web-centric programming framework (among many other things). Beginning with this seventh edition, it became clear to me that a complete update of the book would have taken an extremely long time on my own. To be sure, my own life has become much busier than it was in 2001 (or even 2011; I suspect becoming a father has something to do with this or maybe too many graduate school classes…hmm). In any case, when Apress approached me to update the book for the latest edition of the .NET platform, we considered a number of different approaches to get the book out in a timely manner. Eventually, we agreed it might be time to bring in a helping and capable hand to update portions of the text. Apress suggested that I meet with Philip Japikse to see whether he might be a good match. After a series of phone conversations, e-mail threads, and some careful thought, I was happy to bring him onboard to work on this project. I am happy to announce C# 6.0 and the .NET 4.6 Framework has been a joint effort between myself and co-author Philip Japikse. Please allow Philip to introduce himself… —Andrew Troelsen