请输入您要查询的百科知识:

 

词条 MoreEffectiveC#改善C#程序的50个具体办法
释义

More Effective C#改善C#程序的50个具体办法

作 者: (美)瓦格纳 著

出 版 社: 人民邮电出版社

出版时间: 2009-11-1

开 本: 16开

印 次: 1

纸 张: 胶版纸

I S B N : 9787115215109

包 装: 平装

所属分类: 图书 >> 计算机/网络 >> 程序设计 >> C C++ C# VC VC++

定价:¥55.00

内容简介

本书针对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

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/2/7 19:26:10