Thread构造函数要接收一个“代表”,创建一个新线程必须有一个代表“ThreadStart”,例子如下:using System;
using System.Threading;class SimpleThreadApp
{ public static void WorkerThreadMethod()
{
Console.WriteLine("Worker thread started");
} public static void Main()
{
ThreadStart worker = new ThreadStart(WorkerThreadMethod); Console.WriteLine("Main - Creating Worker thread"); Thread t = new Thread(worker);
t.Start(); Console.WriteLine("Main - Have requested the start of Worker thread");
}
}
using System.Threading;class SimpleThreadApp
{ public static void WorkerThreadMethod()
{
Console.WriteLine("Worker thread started");
} public static void Main()
{
ThreadStart worker = new ThreadStart(WorkerThreadMethod); Console.WriteLine("Main - Creating Worker thread"); Thread t = new Thread(worker);
t.Start(); Console.WriteLine("Main - Have requested the start of Worker thread");
}
}
解决方案 »
- DataGridView 如何设置 上标字符?
- 水晶报表---问题请教
- 如何对Bin文件夹中的Word文档内容进行读取后有条件的追加内容后打印该Word文档——急
- ToolStripMenuItem 快捷键设置无效
- C#稀奇问题! 读取文本的ReadLine不读一行!各位路过的请帮忙看看!
- 我是菜鸟,请问如何用c#进行文本的创建、修改、读取之类的工作啊??
- 怎样可以删除在picturebox曾经加载过的图像文件?
- 关于站内短消息的操作问题
- 关于c#变量的命名问题
- DataGridView中数据导出到文本文档 希望大家帮忙 多谢了
- Clipboard 能放对象吗?好象Microsoft自己的例子都不能跑?大家帮我Run 一Run看。
- com+组件导出的客户端代理,安装到win98客户机,客户机createObject出错
2. TranBmp/TranText不要写成static函数。
3. class1 c = new class1();
c.ResourceStr = ...;
c.AimStr = ...;
4. ThreadStart ts = new ThreadStart(c.TranBmp);
Thread t = new Thread(ts);
t.Start();
http://www.yesky.com/20020129/215831.shtml