首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C#给线程传接参数

2012-08-31 
C#给线程传递参数需要注意的是怎样给线程传递参数。using Systemusing System.Collections.Genericusing

C#给线程传递参数

需要注意的是怎样给线程传递参数。

using System;using System.Collections.Generic;using System.Data.OleDb;using System.Diagnostics;using System.IO;using System.Text;using System.Threading;namespace Test{    public class Program{      public test(){        TestObject t = TestObject("sky素年锦时");        Thread thread = new Thread(hello);        thread.Start(t);            }                //线程执行的代码,o为传递的参数对象      public void hello(Object o){          Console.Out.WriteLine("Hello, this is " + o.name);      }    }    class TestObject{      public String name;      public TestObject(){        this.name= name;      }    }}
?

热点排行