AI智能
改变未来

C#线程中执行多个参数的方法

public void onReceive(byte commId, byte terId, byte zoneId, byte alarmType){//将参数打包byte[] bytes = new byte[]{ commId,terId,zoneId,alarmType};Thread t = new Thread(new ParameterizedThreadStart(onReceiveReal));t.Start(bytes);}//重载要执行的方法private void onReceiveReal(object o){byte[] a = new byte[4];a = (byte[])o;onReceiveReal(a[0],a[1],a[2],a[3]);}private void onReceiveReal(byte commId, byte terId, byte zoneId, byte alarmType){}
赞(0) 打赏
未经允许不得转载:爱站程序员基地 » C#线程中执行多个参数的方法