1.詞匯
- delegate type 委托類(lèi)型
- delegate instance 委托實(shí)例
- interface 接口
2.例句
-
I’m sure you already have an instinctive idea about what a delegate is, even though it can be hard to articulate. Essentially,delegates provide a level of indirection: instead of specifying behavior to be executed immediately, the behavior can somehow be “contained” in an object. That object can then be used like any other, and one operation you can perform with it is to execute the encapsulated action. Alternatively, you can think of a delegate type as a singlemethod interface, and a delegate instance as an object implementing that interface.
可以肯定,你對(duì)委托delegate有了直觀的認(rèn)識(shí),即使此時(shí)你無(wú)法清晰的描述出來(lái)。實(shí)際上,委托在某種程度上提供了間接的方法:不需要直接指定一個(gè)要立即執(zhí)行的行為,而是將這個(gè)行為包裹在對(duì)象里,這個(gè)對(duì)象可以像其他對(duì)象那樣使用,在該對(duì)象中可以執(zhí)行封裝的操作。換言之,可以將委托類(lèi)型當(dāng)做只定義了一個(gè)方法的接口,而委托實(shí)例當(dāng)做是實(shí)現(xiàn)了該接口的一個(gè)對(duì)象