The ParameterizedThreadStart display adapter is declared as:
public delegate void ParameterizedThreadStart(object obj);
It is clear that this delegate is not compatible with your method signature, and there is no direct way to get System.Threading.Thread to work with an arbitrary type of delegation.
One of your options would be to use a compatible signature for the method and match:
private void SendStatus(object obj) { UDPData data = (UDPData)obj; ... }
Another option is to compose the problem with the C # compiler by creating a closure. For instance:
new Thread(() => SendStatus(udpData)).Start();
Note that a ThreadStart delegate is used ThreadStart . In addition, you should be careful with the subsequent change to the local udpData , as it is committed.
Alternatively, if you don't mind using a thread pool instead of creating your own thread, you can use asynchronous delegates. For instance:
Action<UDPData> action = SendStatus; action.BeginInvoke(udpData, action.EndInvoke, null);
source share