Refer to the System.Threading namespace on MSDN for full details. Meanwhile here is a quick taste.

using System; 
using System.Threading; 

class ThreadTest 
{ 
    public void Runme() 
    { 
        Console.WriteLine("Runme Called"); 
        Thread.Sleep(10000); 
    }

    public static void Main(String[] args)
    { 
        ThreadTest b = new ThreadTest(); 
        Thread t = new Thread(new ThreadStart(b.Runme)); 
        t.Start(); 

        Console.WriteLine("Thread 't' started.");
Console.WriteLine("
There is no telling when " +
"'Runme' will be invoked. "); t.Join(); Console.WriteLine("Thread 't' has ended."); } }
[Author: Santosh Zachariah]
[导入]Where can I find sample C# code for simple threading?
文章来源:http://blogs.msdn.com/csharpfaq/archive/2004/03/15/90082.aspx

相关文章:

  • 2022-01-25
  • 2021-11-03
  • 2022-12-23
  • 2021-08-06
  • 2021-05-30
  • 2021-06-20
  • 2021-09-20
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-09-28
  • 2021-05-22
  • 2022-12-23
  • 2021-05-26
  • 2022-12-23
相关资源
相似解决方案