zoukankan      html  css  js  c++  java
  • asp.net 异步处理

     1 #region   异步测试
     2         //委托
     3         public delegate void PrintDelegate(string s);
     4         [WebMethod]
     5         public string yibu()
     6         {
     7             //主线程
     8             PrintDelegate printDelegate = Print;
     9             printDelegate.BeginInvoke("", PrintComeplete, printDelegate);
    10             return "OK";
    11         }
    12 
    13         public static void Print(string s)
    14         {
    15             //"异步线程开始执行 逻辑方法在此写"
    16             //Thread.Sleep(5000);
    17              
    18         }
    19         //回调方法要求
    20         //1.返回类型为void
    21         //2.只有一个参数IAsyncResult
    22         public static void PrintComeplete(IAsyncResult result)
    23         {
    24             (result.AsyncState as PrintDelegate).EndInvoke(result);
    25             //Console.WriteLine("当前线程结束." + result.AsyncState.ToString());
    26         }
    27         #endregion
  • 相关阅读:
    python 爬虫 urllib模块 url编码处理
    python 爬虫 urllib模块 目录
    python 爬虫 urllib模块介绍
    python 爬虫 目录
    爬虫 介绍
    POJ 2533
    POJ 2531
    POJ 2524
    POJ 2505
    POJ 2521
  • 原文地址:https://www.cnblogs.com/jiebo/p/5969455.html
Copyright © 2011-2022 走看看