首页 > 代码库 > 看看BeginInvoke的用法,亲爱的们

看看BeginInvoke的用法,亲爱的们

看看它是杂带参数的哈 

 

using System;using System.Threading;class MyTest{    delegate bool deleTest(string a,string b);    static void Main(string[] args)    {        deleTest mytest = new deleTest(Test);        IAsyncResult testRecult = mytest.BeginInvoke("a", "b", null, null);        Write();                Console.WriteLine(mytest.EndInvoke(testRecult));    }    public static bool Test(string s1, string s2)    {        Thread.Sleep(3000);        Console.WriteLine("InTest");        if (s1 == s2)            return true;        return false;    }    public static void Write()    {        Console.WriteLine("InWrite");    }}/*运行结果:InWriteInTestFalse*/

 

看看BeginInvoke的用法,亲爱的们