Cancel Cross-thread access
Control.checkforillegalcrossthreadcalls = false;
1. Open a new thread
No parameters
Thread thread = new Thread(方法名); thread.Start();
With parameters
The method parameter needs to be set to object when used and then strongly turned down.
Thread thread = new Thread(方法名); thread.Start(参数);
2. Background Threads
The threads that are created by default are foreground threads. As long as there is a foreground thread running, the program will not exit.
When set to a background thread, all foreground threads in the program exit, and the running background thread is forced to stop.
thread.IsBackground = true;
3. Updating the UI thread
By defining an action delegate to execute
Action act = delegate { //更新操作 }; this.Invoke(act);
Process 1. Start the program
Process.Start("EXE文件全路径");
2. Open the specified folder
Process.Start("explorer.exe", 文件夹路径);
MORE: Multithreading in C #
. NET Simple Multithreading