How to disable automatic parentheses in new statement in Visual Studio?

Viewed 69

I'm using Visual Studio 2022, the language is C#.

I have such a class and its nested class like this:

class Peer
{
    public class ServerCommandQuit {}
    public Peer(int id) {}
}

To construct an instance of Peer.ServerCommandQuit I will type:

new Peer.ServerCommandQuit();
        ^

The problem is when I press the dot . key, Visual Studio will automatically append a pair of parentheses after the outer class name:

new Peer().

How can I disable this feature? I have tried to uncheck Automatic brace completion and all 4 options in IntelliCode.

1 Answers

After typing peer, press esc and then type "." the brackets will not appear.

The method in the link provided by Yitz can also solve this problem:

enter image description here

Related