Using a lambda expression is really the easiest way.
However, do not use the ThreadPool.QueueUserWorkItem state argument to pass arguments should be considered as an anti-pattern:
The following works sequentially in my application:
var parm = new ParallelInput() { threadIdNbr = threadId, input = input, inputLength = inputLen, leftBlock = leftBlock, leftBlockLength = leftBlockLength, leftSiblingThreadData = leftSiblingThreadData, rightSiblingThreadData = rightSiblingThreadData, threadCommon = threadCommon, globalOutputWriter = globalOutputWriter, threadWrittenAllCounter = threadWrittenAllCounter }; ThreadPool.QueueUserWorkItem(pp => { var p = (ParallelInput)pp; rdr.parallelConvert(p.threadIdNbr, p.input, p.inputLength, p.leftBlock, p.leftBlockLength, p.leftSiblingThreadData, p.rightSiblingThreadData, p.threadCommon, p.globalOutputWriter, p.threadWrittenAllCounter); }, parm);
... and on my hardware it doesnβt work consistently:
ThreadPool.QueueUserWorkItem(_ => rdr.parallelConvert(threadId, input, inputLen, leftBlock, leftBlockLength, leftSiblingThreadData, rightSiblingThreadData, threadCommon, globalOutputWriter, threadWrittenAllCounter), null);
... since it cannot provide all the data in the input array. (Tested with VS2010 and .NET v4.0.30319)