官术网_书友最值得收藏!

Constructing a delegate

First, in order to make the delegate, above the line beginning with public partial class..., enter the following:

public delegate void Summarize<T>(T x, T y);

Here, public means accessible anywhere, delegate is a keyword, and void doesn't return a value. The delegate name is Summarize, and it can act on different data types because T is present and not integer, double, or something like that. T is a generic.

Now remember, delegates serve essentially as function wrappers. Correct? You use them to point to multiple functions, so you can cascade function calls, for example. The same principle holds here. So, for example, to make use of this, enter the following between a set of curly braces under the line beginning with protected void Button1_Click...:

Summarize<double> s =
主站蜘蛛池模板: 灌云县| 乐东| 手游| 永清县| 石渠县| 黎川县| 墨脱县| 长岭县| 桃江县| 东乌珠穆沁旗| 泉州市| 宁城县| 蕲春县| 措美县| 东辽县| 平南县| 张家界市| 盘山县| 荆门市| 波密县| 昂仁县| 喜德县| 疏附县| 扎赉特旗| 浦县| 甘洛县| 攀枝花市| 平远县| 新安县| 东阿县| 广昌县| 盐边县| 平原县| 新巴尔虎右旗| 蓬莱市| 沛县| 南宫市| 塘沽区| 金阳县| 莱州市| 邯郸县|