-
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));
}
}