C#中一些你可能没用过的调试窗口的方法中一些你可能没用过的调试窗口的方法
其他窗口比较常用,就不介绍了,是不是有一些你没用到的窗口呢?
首先说明:如果没有进入调试模式的话,默认的调试窗口如下:
开始前的准备:开始前的准备:
新建控制台程序DebugWindowDemo:
修改修改Program.cs 的代码为:的代码为:
复制代码 代码如下:
using System;
using System.Threading;
using System.Threading.Tasks;
using System.Diagnostics;
class S
{
public static void Main()
{
pcount = Environment.ProcessorCount;
Console.WriteLine("Proc count = " + pcount);
ThreadPool.SetMinThreads(4, -1);
ThreadPool.SetMaxThreads(4, -1);
t1 = new Task(A, 1);
t2 = new Task(A, 2);
t3 = new Task(A, 3);
t4 = new Task(A, 4);
Console.WriteLine("Starting t1 " + t1.Id.ToString());
t1.Start();
Console.WriteLine("Starting t2 " + t2.Id.ToString());
t2.Start();
Console.WriteLine("Starting t3 " + t3.Id.ToString());
t3.Start();
Console.WriteLine("Starting t4 " + t4.Id.ToString());
t4.Start();
Console.ReadLine();
}
static void A(object o)
{
B(o);
}
static void B(object o)
{
C(o);
}
static void C(object o)
{
int temp = (int)o;
Interlocked.Increment(ref aa);
while (aa < 4)
{
}