Effective C#之 Chapter 3. Expressing Designs with C#

  rel="File-List" href="file:///C:%5CDOCUME%7E1%5CHelios%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"> rel="themeData" href="file:///C:%5CDOCUME%7E1%5CHelios%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"> rel="colorSchemeMapping" href="file:///C:%5CDOCUME%7E1%5CHelios%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml">

Chapter 3. Expressing Designs with C#

第三章C#高级设计

The C# language introduced new syntax to describe your designs. The techniques you choose communicate your design intent to the developers who maintain, extend, or use the software you develop. C# types all live inside the .NET environment. The environment makes some assumptions about the capabilities of all types as well. If you violate those assumptions, you increase the likelihood that your types won't function correctly.

C#语言引入了新语法描述你的设计。你选择的技术将你的设计意图在维护人员、扩展人员或者使用人员之间进行交流。C#类型全部处于.Net环境内部。环境也对你的类型的能力做一些假设。如果你违反那些假设,就增加了你的类型功能不正常的可能性。

These items are not a compendium of software design techniques entire volumes have been written about software design. Instead, these items highlight how different C# language features can best express the intent of your software design. The C# language designers added language features to more clearly express modern design idioms. The distinctions among certain language features are subtle, and you often have many alternatives to choose from. More than one alternative might seem "best" at first; the distinctions show up only later, when you find that you must enhance an existing program. Make sure you understand these items well, and apply them carefully with an eye toward the most likely enhancements to the systems you are building.

这些条款不是已经被编写好的整卷软件设计技术的纲要。相反,这些条款突出了不同的C#语言特性如何最好的表达了你的软件设计意图。C#语言设计者加入语言特性来更清晰的表述现代设计习惯。这些语言特性之间的区别是微小的,你经常有很多选择。不止一个选择可能在开始看起来都“最好”;只有在以后,当你发现必须增强现有系统,区别才会显现。确保你很好的理解了这些条款,小心的应用它们,时刻关注你正在构建的系统最有可能性的增强。

Some syntax changes give you new vocabulary to describe the idioms you use everyday. Properties, indexers, events, and delegates are examples, as is the difference between classes and interfaces: Classes define types. Interfaces declare behavior. Base classes declare types and define common behavior for a related set of types. Other design idioms have changed because of the garbage collector. Still others have changed because most variables are reference types.

一些语法改变给了你新的词汇来描述每天都在使用的习惯。像类和接口的区别(类定义类型,接口定义行为)一样,属性,索引器,事件,委托都是例子。基类声明类型,为一系列相关类型的集合定义共同的行为。由于垃圾收集器的存在,一些设计习惯已经改变了。由于多数变量是引用类型,其他一些也改变了。

The recommendations in this chapter will help you pick the most natural expression for your designs. This will enable you to create software that is easier to maintain, easier to extend, and easier to use.

本章的建议会帮助你,为设计选择最自然的表述方式。这会使你能够创建易维护,易扩展,易使用的软件。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值