Effective C# : 50 Specific Ways to Improve Your C#(Covers C# 6.0), 3/e (Paperback)

Bill Wagner

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

商品描述

In Effective C#, Third Edition, respected .NET expert Bill Wagner identifies 50 ways to harness the full power of the C# 6.0 language to write exceptionally robust, efficient, and well-performing code. Reflecting the growing sophistication of the C# language and its development community, Wagner has identified dozens of new ways to write better code. This edition’s new solutions include some that take advantage of generics and several that are more focused on LINQ, as well as a full chapter of advanced best practices for working with exceptions.

 

Wagner’s clear, practical explanations, expert tips, and realistic code examples have made Effective C# indispensable to hundreds of thousands of developers. Drawing on his unsurpassed C# experience, he addresses everything from resource management to multicore support, and reveals how to avoid common pitfalls in the language and its .NET environment. Learn how to choose the most effective solution when multiple options exist, and how to write code that’s far easier to maintain and improve. Wagner shows how and why to


  • Prefer implicitly typed local variables (see Item 1)
  • Replace string.Format() with interpolated strings (see Item 4)
  • Express callbacks with delegates (see Item 7)
  • Make the most of .NET resource management (see Item 11)
  • Define minimal and sufficient constraints for generics (see Item 18)
  • Specialize generic algorithms using runtime type checking (see Item 19)
  • Use delegates to define method constraints on type parameters (see Item 23)
  • Augment minimal interface contracts with extension methods (see Item 27)
  • Create composable APIs for sequences (see Item 31)
  • Decouple iterations from actions, predicates, and functions (see Item 32)
  • Prefer lambda expressions to methods (see Item 38)
  • Distinguish early from deferred execution (see Item 40)
  • Avoid capturing expensive resources (see Item 41)
  • Use exceptions to report method contract failures (see Item 45)
  • Leverage side effects in exception filters (see Item 50)


You’re already a successful C# programmer, and this book will make you an outstanding one.

 

Content Update Program: This book is part of the InformIT Content Update Program. As updates are made to C#, sections of this book will be updated or new sections will be added to match updates to the technologies. See inside for details.

商品描述(中文翻譯)

在《Effective C#,第三版》中,受人尊敬的.NET專家Bill Wagner確定了50種利用C# 6.0語言的全部潛力來撰寫非常堅固、高效和良好執行的程式碼的方法。反映了C#語言及其開發社群日益複雜的特性,Wagner確定了數十種撰寫更好程式碼的新方法。本版的新解決方案包括一些利用泛型的方法和一些更專注於LINQ的方法,還有一整章關於處理異常的高級最佳實踐。

Wagner清晰、實用的解釋、專家建議和實際的程式碼示例使《Effective C#》成為數以十萬計開發人員必不可少的工具。他根據自己無與倫比的C#經驗,從資源管理到多核支援,談到了如何避免語言及其.NET環境中的常見陷阱。學習如何在多個選項存在時選擇最有效的解決方案,以及如何撰寫更易於維護和改進的程式碼。Wagner展示了如何以及為什麼要選擇以下方法:

- 偏好隱式類型的本地變數(參見第1項)
- 使用插值字串替換string.Format()(參見第4項)
- 使用委派表示回調(參見第7項)
- 充分利用.NET資源管理(參見第11項)
- 為泛型定義最小和足夠的約束(參見第18項)
- 使用運行時類型檢查對泛型算法進行特殊化(參見第19項)
- 使用委派為類型參數定義方法約束(參見第23項)
- 通過擴展方法增強最小接口契約(參見第27項)
- 為序列創建可組合的API(參見第31項)
- 將迭代與操作、預測和函數分離(參見第32項)
- 偏好使用lambda表達式而不是方法(參見第38項)
- 區分早期執行和延遲執行(參見第40項)
- 避免捕獲昂貴的資源(參見第41項)
- 使用異常報告方法契約失敗(參見第45項)
- 在異常過濾器中利用副作用(參見第50項)

你已經是一位成功的C#程式設計師,而這本書將使你成為一位傑出的程式設計師。

內容更新計劃:本書是InformIT內容更新計劃的一部分。隨著C#的更新,本書的部分內容將得到更新,或者新增新的內容以配合技術的更新。詳情請參閱內頁。