国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > 綜合 > 正文

C#中簡單實現多線程

2024-07-21 02:29:28
字體:
來源:轉載
供稿:網友

感覺用c#進行開發就是快

using system;
using system.threading;

namespace consoleapplication1
{
 /// <summary>
 /// class1 的摘要說明。
 /// </summary>
 class class1
 {
  /// <summary>
  /// 應用程序的主入口點。
  /// </summary>
  [stathread]
  static void main(string[] args)
  {
   //
   // todo: 在此處添加代碼以啟動應用程序
   //
   thread thread1 = new thread(new threadstart(method1));
   thread thread2 = new thread(new threadstart(method2));
   thread1.start();
   thread2.start();
  
  }
  public static void method1()
  {
   while(true)
   {
    console.writeline("this is thread : 1");
    thread.sleep(1000);

   }
  
  }
  public static void method2()
  {
   while (true)
   {
    console.writeline("this is thread : 2");
    thread.sleep(1520);
   }
  

  }
 }
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 平利县| 哈巴河县| 扎赉特旗| 台山市| 新晃| 平山县| 焦作市| 南江县| 乌兰浩特市| 咸阳市| 宜州市| 行唐县| 墨玉县| 礼泉县| 五大连池市| 萝北县| 安仁县| 蕲春县| 徐州市| 庐江县| 柘城县| 望奎县| 太谷县| 聂拉木县| 宾川县| 永康市| 喜德县| 武川县| 绥江县| 长丰县| 宝丰县| 临洮县| 兴和县| 淮安市| 锦州市| 仲巴县| 南昌县| 桂林市| 萨迦县| 明水县| 鄂尔多斯市|