using 后面是引用别的命名空间(已经存在的,编译好的)
namespace 你要定义的新的命名空间(你创建的)

你用vs创建一个控制台的时候(系统如下给你创建的):
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HelloWord
{
    class Program
    {
        static void Main(string[] args)
        {
        }
    }
}


//-----------------------------------------------
(那些用不到的using 可以直接删了,程序照样跑)
using System;

namespace HelloWord
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Hello Word");
            Console.ReadKey();
        }
    }
}


//----------------------------------------

(OK,最后再看这个没有using的,程序也照样跑)
namespace HelloWord
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Console.WriteLine("Hello Word");
            System.Console.ReadKey();
        }
    }
}
//---------------------------------------
(如果我上面这个想正常运行,我就得加在console这个类面前都得加system;但如果我在文件头部using,引用一次,以后用到Console这个类的时候就不用再写system了,这次明白了吧)

相关文章:

  • 2022-01-13
  • 2022-12-23
  • 2021-06-05
  • 2022-12-23
  • 2021-10-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-16
  • 2022-12-23
  • 2022-12-23
  • 2021-11-20
  • 2022-12-23
  • 2022-01-11
相关资源
相似解决方案