首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C#的嘱托类基本实现

2012-12-20 
C#的委托类基本实现?因为项目需要,对C#进行了一些了解应用,现将收集资料存档,以备查。?C#的委托类基本实现?

C#的委托类基本实现

?

因为项目需要,对C#进行了一些了解应用,现将收集资料存档,以备查。

?

C#的委托类基本实现

?

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading;using System.Security.Permissions;namespace ConsoleApplication1{    class Program    {        //1.定义一个Delegate函数数据结构        public delegate void GoDelegate();        //2.定义Delegate将引用的静态方法或引用类实例及该类的实例方法        public static void MyDelegateFunc()        {            //方法实现        }        [STAThread]        public static void Main(string[] args)        {            /* 委托处理 start */            //3.Delegate数据变量指向实例方法            GoDelegate goDelegate = new GoDelegate(MyDelegateFunc);            //4.通过Delegate数据变量执行实例方法            //goDelegate();            goDelegate.BeginInvoke(null, null);//开始执行houtaiprogram函数            Console.WriteLine("control ok.");            /* 委托处理 end */        }    }}

??

?

热点排行