Change Default Namespace when creating Class in Folder (Visual Studio)

后端 未结 5 387
一生所求
一生所求 2020-12-08 09:34

How can I change the default namespace used when you create a new class in Visual Studio?

Background: My solution has a project MyCompany.MyProject.Domain in which I

5条回答
  •  失恋的感觉
    2020-12-08 10:02

    If you already have one class under that folder with the desired namespace. You could take advantage of the Move type to ClassName.cs light bulb suggestion.

    For example, you created Order.cs with the correct namespace MyCompany.MyProject.Domain.Model under the Extensions folder. If you want to add Trace class you do it like so:

    Ctrl + . when the edit cursor is anywhere around the class Trace words will show the suggestion.

    so... Ctrl + . Down Down Enter

    Result:

提交回复
热议问题