欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

异步执行

程序员文章站 2022-03-20 10:18:38
//BS架构下的异步执行文件 public delegate void NotifyExamDelegate(int SingleCount); AsyncSendEmailToUser(0); void AsyncSendEmailToUser(int SingleCount) { NotifyE ......
异步执行
//bs架构下的异步执行文件

     public delegate void notifyexamdelegate(int singlecount);


    asyncsendemailtouser(0); 


     void asyncsendemailtouser(int singlecount)
        {
            notifyexamdelegate del = new notifyexamdelegate(sendemailtouser);
            iasyncresult ar = del.begininvoke(singlecount, new asynccallback(callbackmethod), del);
        }

        void callbackmethod(iasyncresult ar)
        {
            notifyexamdelegate del = (notifyexamdelegate)ar.asyncstate;
            del.endinvoke(ar);
        }

    public void sendemailtouser(int num)
        { 
            bool flag = bll.insert_hr_exam_user();
        }
异步执行