国产探花免费观看_亚洲丰满少妇自慰呻吟_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);
   }
  

  }
 }
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 桐柏县| 鲁山县| 鄱阳县| 南江县| 日土县| 眉山市| 海口市| 丰台区| 原平市| 滨州市| 若尔盖县| 定西市| 油尖旺区| 栾城县| 玛多县| 合山市| 永康市| 东乡族自治县| 怀来县| 盘山县| 岳阳县| 阿瓦提县| 台中市| 广宁县| 长海县| 中西区| 嘉兴市| 阆中市| 松潘县| 黄山市| 嘉定区| 安远县| 内乡县| 榆中县| 象州县| 蕉岭县| 衡阳市| 云阳县| 库尔勒市| 育儿| 无极县|