引用自定义命名空间

来源:互联网 发布:提升店铺流量软件 编辑:程序博客网 时间:2024/05/21 09:56

首先创建自己的命名空间Son:

namespace Son
{
    public class TestSon
    {
        public void show()
        {
            System.Console.WriteLine("Hello China");
        }
        static void Main()                                                                //Main()函数为入口函数,必须的。
        {
         
        }
    }
}

在项目Father中直接引用:

using Son;
namespace Father
{
    class TestFather
    {
        static void Main()
        {
            TestSon ts = new TestSon();
            ts.show();
        }
    }
}

0 0