C#英語(yǔ)筆記Day 40

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ì)象

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容