thread with multiple parameters

前端 未结 11 1602
一生所求
一生所求 2020-11-29 04:16

Does anyone know how to pass multiple parameters into a Thread.Start routine?

I thought of extending the class, but the C# Thread class is sealed.

Here is wh

11条回答
  •  Happy的楠姐
    2020-11-29 04:57

    You can take Object array and pass it in the thread. Pass

    System.Threading.ParameterizedThreadStart(yourFunctionAddressWhichContailMultipleParameters) 
    

    Into thread constructor.

    yourFunctionAddressWhichContailMultipleParameters(object[])
    

    You already set all the value in objArray.

    you need to abcThread.Start(objectArray)

提交回复
热议问题