none
C#如何在同一个项目中新建一个namespace命名空间 RRS feed

全部回复

  • Hi pengyang,

    你可以直接在项目中使用关键字namespace来创建一个新的命名空间。

    例如可以像下面这样:

    using Testnamespace;
    
    namespace ConsoleApp1
    {
        class Program
        {
            static void Main(string[] args)
            {
                Student student = new Student();
            }
        }
    }
    
    namespace Testnamespace
    {
        public class Student
        {
        
    
        }
    
    }

    你也可以查看下面的链接来了解如何在c#项目中添加命名空间。

    Adding new Namespace in C# Project

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    2020年9月15日 5:21
    版主