Autocomplete Method Brackets

20,886

Solution 1

When doing autocomplete, instead of just hitting ENTER, you can instead press the key combination "Shift + (" and it will autocomplete and add () all in the one.

Solution 2

You can turn on Automatic Brace Completion at: Tools->Options->Text Editor->C#->General .

Tools->Options->Text Editor->C#->IntelliSense is for auto-completion of variables and keywords.

Solution 3

With the current version of Visual Studio 2019 (Version 16.10.x), press the Tab key twice to insert arguments (also brackets). This is an experimental feature and needs to be enabled in Options -> Text Editor -> C# -> IntelliSense -> Tab twice to insert arguments (experimental).

Solution 4

Even though the question was for Visual Studio 2013, on Visual Studio 2017 you can install ReSharper plugin by JetBrains that among other things, it automatically add brackets to methods when auto-completing.

Share:
20,886
Admin
Author by

Admin

Updated on June 23, 2021

Comments

  • Admin
    Admin almost 3 years

    Using: Visual Studio Pro 2013

    Previous research: [1], [2], [3]

    I'm used to working in Java with Eclipse.

    My usual flow is: object. CTRL+SPACE + ENTER which autocompletes the method and places the correct curly brackets & method inputs in there:

    object.myMethod();
    or
    object.myMethod(input1,input2);
    

    I'm trying to get the same behaviour with VS in C#. I can get the method, but it doesn't want to include the final brackets for some reason.

    I get:

    object.myMethod
    

    Is there a way to enable this?

  • pomber
    pomber almost 9 years
    That is just for closing brackets
  • MattFiler
    MattFiler about 5 years
    Perfect solution!