C#英語筆記Day 43

1.詞匯

  • delegate type 委托類型
  • delegate instance 委托實例
  • derive from 繼承自

2.例句

  • A delegate type is effectively a list of parameter types and a return type. It specifies what kind of action can be represented by instances of the type.For instance, consider a delegate type declared like this:

    委托類型由參數(shù)列表和返回類型構(gòu)成。它指定了委托實例可以執(zhí)行什么樣的操作。比如,一個委托類型的聲明的格式如下:

delegate void StringProcessor(string input);
  • The code says that if you want to create an instance of StringProcessor, you’ll need a method with one parameter (a string) and a void return type.

    這段代碼是說,如果你要創(chuàng)建一個StringProcessor的實例,你提供的方法中要包含一個字符串參數(shù)和返回的類型為void.

  • It’s important to understand that StringProcessor really is a type, deriving from System.MulticastDelegate, which in turn derives from System.Delegate. It has methods, you can create instances of it and pass around references to instances, the whole works.

    StringProcessor是一個類型,這一點非常重要,其繼承自System.MulticastDelegate,而System.MulticastDelegate又繼承自System.Deleagate. 它有方法,你可以創(chuàng)建實例的時候傳遞引用給實例,這一切都沒有問題。

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

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