线程 Thread 传参数
private static void IsVMStateChanged(object status)
{
object[] parms = (object[])status;
string machineId = (string)parms[0];
VM vm = ShareFactory.GetVMByID(new Guid(machineId));
if (vm.StatusString.Equals("Creating..."))
{
System.Threading.Thread.Sleep(1000);
Thread threadWithParam = new Thread(new ParameterizedThreadStart(IsVMStateChanged));
threadWithParam.Start(new object[] { machineId});
}
else if (vm.StatusString.Equals("Running"))
{
//do something
}
}
Call Method:
IsVMStateChanged(new object[] { machineId});