方法1:
public
void
Execute(
string
device,
string
type)
{
object
[] paras =
new
object
[] { device,type };
new
Thread(
new
ParameterizedThreadStart(tExecute)).Start(paras);
}
private
void
tExecute(
object
para)
{
object
[] paras = (
object
[])para;
string
device = (
string
)paras[0];
string
type=(
string
)paras[1];
。。。
}
方法2:
public
void
Execute(int
x,int
y)
{
My m =
new
My();
m.x = x;
m.y = y;
Thread t =
new
Thread(
new
ThreadStart(m.C));
t.Start();
}
class
My
{
public
int
x, y;
public
void
C()
{
Console.WriteLine(
"x={0},y={1}"
,
this
.x,
this
.y);
}
}
方法3:
Thread t =
new
Thread(
new
ParameterizedThreadStart(Execute));
t.Start(
"B"
);
private
static
void
Execute(
object
obj)
{
Console.WriteLine(
"Execute{0}!"
,obj.ToString ());
}