Passing Data in Parameters

Avoid using the ParameterizedThreadStart Delegate
You should use the ThreadStart delegate in conjunction with anonymous methods or a lambda function.


System.Threading.Thread myThread; 
myThread = new System.Threading.Thread ( () => myMethod(200, "some text"));
myThread.Start();

public static void myMethod(int param1, string param2) {}




© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext