資源簡介
委托是一類繼承自System.Delegate的類型,每個委托對象至少包含一個指向某個方法的指針,該方法可以是實例方法,也可以是靜態方法。委托實現了回調方法的機制。
代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.Text;
using?System.Threading;
namespace?委托練習
{
????class?Program
????{
????????public?delegate?double?TextDelegate(int?i);?//聲明一個委托
????????static?double?PrintMessage(int?i)???????????//定義一個靜態方法
????????{
????????????return?i?*?i;
????????}
????????static?void
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????732??2014-04-01?22:07??Program.cs
-----------?---------??----------?-----??----
??????????????????732????????????????????1
- 上一篇:c# 常用方法 編程速查 chm文檔
- 下一篇:C#初學者,多線程入門
評論
共有 條評論