Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 451
user3235057 Avatar asked Jan 30 '14 19:01

user3235057


3 Answers

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.

like image 101
Murray Avatar answered Nov 13 '22 05:11

Murray


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.

like image 2
Steve Avatar answered Nov 13 '22 03:11

Steve


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

like image 2
Mihir Avatar answered Nov 13 '22 05:11

Mihir