看以下代码
using System;
using System.Collections.Generic;
using System.Text;namespace ConsoleApplication10
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("myfunc() function about to be called.");
            Debug.WriteLine("added 1 to i", "myfunc");
                   }
    }
}
实际上我也只是看一下书关于debug 的用法,看是不是跟VB中的一样,结果呢发现C#不支持这个关键字,不知道为什么,请高人指点.(提示错误是上下文中不存在名称"Debug") 

解决方案 »

  1.   

    using System.Diagnostics;
    using System.Collections.Generic;
    using System.Text;namespace ConsoleApplication10
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("myfunc() function about to be called.");
                Debug.WriteLine("added 1 to i", "myfunc");
                
                       }
        }
    }
    这样子写吗,运行也错误.
      

  2.   

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Diagnostics;
    namespace ConsoleApplication10
    {
        class Program
        {
            static void Main(string[] args)
            {
                Console.WriteLine("myfunc() function about to be called.");
                Debug.WriteLine("added 1 to i", "myfunc");                   }
        }
    }
    这样子就没有问题了,谢谢各位,但using System.Diagnostics; 
    起什么作用的呢,请指点一下,非常感谢.
      

  3.   

    应用程序集合  System.Diagnostics
    如果不using ,写
    System.Diagnostics.Debug 也可以.