user3235057
user3235057

Reputation: 413

Autocomplete Method Brackets

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?

Upvotes: 41

Views: 23303

Answers (4)

Mihir
Mihir

Reputation: 449

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).

Upvotes: 2

Murray
Murray

Reputation: 51

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.

Upvotes: 5

Lefteris008
Lefteris008

Reputation: 907

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.

Upvotes: 1

Steve
Steve

Reputation: 633

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.

Upvotes: 2

Related Questions