private void voBtnThreadAsTask_Click(object sender, EventArgs e) { TcCompute koMC = new TcCompute( ); Action koComputeF = new Action(koMC.MCompute3); Task koTask = new Task(koComputeF); koMC.VfData1 = 24.22f; koMC.ViData2 = 11; koTask.Start( ); koTask.Wait( ); MessageBox.Show("Result = " + koMC.VdRes.ToString( )); }
private void voBtnThreadLikeTask_Click(object aoSender, EventArgs aoArgs) { TcCompute koMC = new TcCompute( ); Action koComputeF; Thread koComputeT; koMC.VfData1 = 24.22f; koMC.ViData2 = 11; koComputeF = new Action(koMC.MCompute3); koComputeT = new Thread(new ThreadStart(koComputeF)); koComputeT.Start( ); koComputeT.Join( ); MessageBox.Show("Result = " + koMC.VdRes.ToString( )); }