【带有参数的线程】
private void GetLoadFuncation()
{
Thread thread = new Thread(new ParameterizedThreadStart(GetAllFuncation));
thread.Name = "泓辰信息";
thread.Start("上海泓辰信息科技有限公司");
}
private void GetAllFuncation(object msg)
{
MessageBox.Show(msg.ToString());
}
【无参数的线程】
System.Threading.Thread thread = new System.Threading.Thread(Start);
thread.Start();
private static void Start()
{
MessageBox.Show("ddd");
}
【WPF线程操作控件】
System.Threading.Thread thread = new System.Threading.Thread(Start);
thread.Start();
private static void Start()
{
System.Windows.Application.Current.Dispatcher.Invoke(System.Windows.Threading.DispatcherPriority.Background, new DoTask(GetFillTreeView));
}
private static void GetFillTreeView()
{
//执行操作
}
多线程操作一览
最新推荐文章于 2024-09-08 09:00:00 发布
本文介绍了三种线程的应用案例:带有参数的线程、无参数的线程及WPF线程中如何操作UI控件。通过具体代码展示了不同场景下线程的启动与执行方式。
1071

被折叠的 条评论
为什么被折叠?



