2008年04月24日
C#中简单实现多线程,
using System; namespace ConsoleApplication1 } }
using System.Threading;
{
/// <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);
}
}
}
本文转自:SEO基地
本文链接:http://www.11zhuce.com/seo/457.html
相关文章 [查看与 C# 简单 实现 多线程 相关的全部文章]- c#中try和finally
- C# 视频教程
- C#实例程序分析
- c#如何入门,基础最重要
- namespace c#
- C# Hello World
- C#和C++的语法和功能区别
- VB.NET多线程开发实例
0 回复,0 引用: C#中简单实现多线程
添加回复