using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using 命名空间2;
using System.Collections;
namespace 命名空间
{
class Program
{
static void Main(string[] args)
{
Person p1 = new Person();
命名空间2.Person p2 = new 命名空间2.Person(); //使用命名空间来区分两个Person类 相当于全路径 用全名时不用使用using声明。
Dog d = new Dog(); //在不同命名空间中 ,要使用 using 命名空间2 ,才可以使用命名空间2中的类。
ArrayList list = new ArrayList(); //本来不能使用ArrayList类的,在ArrayList上右键-解析-添加类 自动加上了using System.Collections;
}
}
class Person
{
}
}
C#学习笔记(十八) --命名空间
最新推荐文章于 2024-07-25 16:48:57 发布