yongshi123

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2008年11月4日

摘要: 索引器的用处其实能让客户端以比较方便简洁的方式去访问客户端所要访问的数据。具体点来说,就好像把类、接口或者结构的实例对象装进了一个数组或者ArrayList中似的,可以通过下标ARR[i]或者ARR["name"]这样的方式来访问对象。索引器的格式如下: public class IndexerClass { //....... public DataType this[int index] { get{} //这里返回的可以是在该类中的某个属性或者某个返回函数 set{} //这里设置该类中的某个属性或者某个返回函数 } 阅读全文
posted @ 2008-11-04 21:16 yongshi123 阅读(190) 评论(0) 推荐(0)

摘要: Introduction Attributes are a new kind of declarative information. We can use attributes to define both design-level information (such as help file, URL for documentation) and run-time information (su... 阅读全文
posted @ 2008-11-04 15:42 yongshi123 阅读(346) 评论(0) 推荐(0)

摘要: Usinng an attribute is a way to add special meaning to our method and cause it to act in a certain way. Before this was available, developers didn't have a way to define their own attributes. DotNet paved the way for developers and opened new horizons to conquer. Attributes are like adding behaviours to methods, classes, properties structures, events, modules, and so forth. It means we can enforce certain constraints on those methods, classes, properties and vice-versa to behave in the way 阅读全文
posted @ 2008-11-04 15:14 yongshi123 阅读(361) 评论(0) 推荐(0)