private void button2_Click(object sender, EventArgs e) { //public delegate void run(); //public delegate void mydele(string s); mydele dele = new mydele(temp); dele.BeginInvoke("开启线程异步计算...", null, null); }
private void JustWatcherSourceDir() { if (!pM.IsPath(textBox1, textBox2)) { return; } justWatcherSourceDir.IncludeSubdirectories = true; justWatcherSourceDir.Path = pM.SourceDirPath; justWatcherSourceDir.NotifyFilter = NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.Attributes | NotifyFilters.CreationTime | NotifyFilters.LastAccess | NotifyFilters.Size; justWatcherSourceDir.Filter = ""; justWatcherSourceDir.Created += new FileSystemEventHandler(justChangedSource); justWatcherSourceDir.Deleted += new FileSystemEventHandler(justChangedSource); justWatcherSourceDir.Changed += new FileSystemEventHandler(justChangedSource); justWatcherSourceDir.Renamed += new RenamedEventHandler(justRenamedSource); justWatcherSourceDir.EnableRaisingEvents = true; testeventhandler += new mydele(Form1_testeventhandler); }
static void Main(string[] args) { A obj = new A(); //make an object of class A mydele m = new mydele(obj.add); m(10, 20); mydele m1 = new mydele(obj.sub); m1(10, 20); A b1 = new A(); //make an object of class A myMultiDele Md = new myMultiDele(b1.add); myMultiDele Md1 = new myMultiDele(b1.sub); Md = Md + Md1; Md(60, 90); Console.ReadKey(); }