首页 > 其他 > 详细

看看BeginInvoke的用法,亲爱的们

时间:2014-12-25 18:06:33      阅读:198      评论:0      收藏:0      [点我收藏+]

看看它是杂带参数的哈 

 

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");
    }
}
/*
运行结果:

InWrite
InTest
False
*/

 

看看BeginInvoke的用法,亲爱的们

原文:http://www.cnblogs.com/wolfocme110/p/4184965.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!