c# 多线程创建 ---简单

时间:2022-01-13 06:44:19

Thread t = new Thread(new ParameterizedThreadStart(UploadCard));
t.IsBackground = false;//后台线程  前台线程不死,进程不死。但是后台线程则相反,进程想死时,线程先自杀。
OrderShipping ordershipping = new OrderShipping();
ordershipping.orderInfo = orderInfo;
ordershipping.shippingAddress = shippingAddress;
t.Start(ordershipping);

方法带参数的话要用 ParameterizedThreadStar 而且只能是一个参数。 object

public  void UploadCard(object data){操作方法}