The great god, how to get the name of all threads in c #, the following code to obtain the name "TestName", thank you very much!
New Thread (()=& gt; { Thread. The CurrentThread. Name="TestName"; For (int I=0; I & lt; 10; I++) { Console. WriteLine (I); Console. WriteLine (" a "+ Thread. CurrentThread. Name); } }). The Start ();
CodePudding user response:
using System; Using System. Diagnostics;
The namespace ConsoleApp1 { Class Program { The static void Main (string [] args) { Foreach (Process p in the Process. GetProcesses ()) { Console. WriteLine (p.P rocessName); } The Console. The Read (); } } }