文件名称:添加方法-C#编写的QQ程序及指导
文件大小:2.01MB
文件格式:PPT
更新时间:2024-05-14 20:35:00
C# QQ 聊天程序
(5)添加方法 方法名为ThreadMethod,代码如下: private void ThreadMethod() { long threadCount = 0; //使用计数测量线程运行的时间 while (m_bContinue) { threadCount++; } if (Thread.CurrentThread.Name == "线程1") { str1 = string.Format("线程:{0},优先级:{1},计数器:{2}\r\n", Thread.CurrentThread.Name, Thread.CurrentThread.Priority.ToString(),Convert.ToString(threadCount)); } else { str2 = string.Format("线程:{0},优先级:{1},计数器:{2}\r\n", Thread.CurrentThread.Name, Thread.CurrentThread.Priority.ToString(),Convert.ToString(threadCount)); } }