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)建實例的時候傳遞引用給實例,這一切都沒有問題。