More Effective C#:改善C#程式的50個具體辦法

More Effective C#:改善C#程式的50個具體辦法

《More Effective C#:改善C#程式的50個具體辦法》,是2009年人民郵電出版社出版的圖書,作者是華格納。

基本介紹

  • 書名:More Effective C#:改善C#程式的50個具體辦法
  • 作者:華格納
  • ISBN:9787115215109
  • 類別:計算機/網路 >> 程式設計 >> C C++ C# VC VC++
  • 定價:¥55.00
  • 出版社:人民郵電出版社
  • 出版時間:2009-11-1
  • 裝幀:平裝
  • 開本:16開
內容簡介,圖書目錄,

內容簡介

本書針對C# 2.0和3.0中添加的新特性給出了改善C#代碼的50條實用建議,其中著重介紹了泛型技術,這是C# 2.0和3.0中眾多新特性的基石。本書按照建議的主題進行分類,其中每個建議針對某個特定問題進行展開,分析了問題的原因,給出解決的辦法。
本書適合各層次.NET開發人員閱讀。

圖書目錄

Chapter 1. Working with Generics
Item 1. Use Generic Replacements of 1.x Framework API Classes
Item 2. Define Constraints That Are Minimal and Sufficient
Item 3. Specialize Generic Algorithms Using Runtime Type Checking
Item 4. Use Generics to Force Compile-Time Type Inference
Item 5. Ensure That Your Generic Classes Support Disposable Type Parameters
Item 6. Use Delegates to Define Method Constraints on Type Parameters
Item 7. Do Not Create Generic Specialization on Base Classes or Interfaces
Item 8. Prefer Generic Methods Unless Type Parameters Are Instance Fields
Item 9. Prefer Generic Tuples to Output and Ref Parameters
Item 10. Implement Classic Interfaces in Addition to Generic Interfaces
Chapter 2. Multithreading in C#
Item 11. Use the Thread Pool Instead of Creating Threads
Item 12. Use BackgroundWorker for Cross-Thread Communication
Item 13. Use lock() as Your First Choice for Synchronization
Item 14. Use the Smallest Possible Scope for Lock Handles
Item 15. Avoid Calling Unknown Code in Locked Sections
Item 16. Understand Cross-Thread Calls in Windows Forms and WPF
Chapter 3. C# Design Practices
Item 17. Create Composable APIs for Sequences
Item 18. Decouple Iterations from Actions, Predicates, and Functions
Item 19. Generate Sequence Items as Requested
Item 20. Loosen Coupling by Using Function Parameters
Item 21. Create Method Groups That Are Clear, Minimal, and Complete
Item 22. Prefer Defining Methods to Overloading Operators
Item 23. Understand How Events Increase Runtime Coupling Among Objects
Item 24. Declare Only Nonvirtual Events
Item 25. Use Exceptions to Report Method Contract Failures
Item 26. Ensure That Properties Behave Like Data
Item 27. Distinguish Between Inheritance and Composition
Chapter 4. C# 3.0 Language Enhancements
Item 28. Augment Minimal Interface Contracts with Extension Methods
Item 29. Enhance Constructed Types with Extension Methods
Item 30. Prefer Implicitly Typed Local Variables
Item 31. Limit Type Scope by Using Anonymous Types
Item 32. Create Composable APIs for External Components
Item 33. Avoid Modifying Bound Variables
Item 34. Define Local Functions on Anonymous Types
Item 35. Never Overload Extension Methods
Chapter 5. Working with LINQ
Item 36. Understand How Query Expressions Map to Method Calls
Item 37. Prefer Lazy Evaluation Queries
Item 38. Prefer Lambda Expressions to Methods
Item 39. Avoid Throwing Exceptions in Functions and Actions
Item 40. Distinguish Early from Deferred Execution
Item 41. Avoid Capturing Expensive Resources
Item 42. Distinguish Between IEnumerable and IQueryable Data Sources
Item 43. Use Single() and First() to Enforce Semantic Expectations on Queries
Item 44. Prefer Storing Expression to Func
Chapter 6. Miscellaneous
Item 45. Minimize the Visibility of Nullable Values
Item 46. Give Partial Classes Partial Methods for Constructors, Mutators, and Event Handlers
Item 47. Limit Array Parameters to Params Arrays
Item 48. Avoid Calling Virtual Functions in Constructors
Item 49. Consider Weak References for Large Objects
Item 50. Prefer Implicit Properties for Mutable, Nonserializable Data
Index

相關詞條

熱門詞條

聯絡我們