1

We used to be able to highlight a field and click Ctrl+. And we would get an option to create a constructor with an argument that would then be assigned to the field. See here.

Now in Visual Studio 2019 it's gone.

Is there a setting for that somewhere, or did Microsoft deem it unuseful for some reason?

ispiro
  • 26,556
  • 38
  • 136
  • 291

1 Answers1

1

It seems to have changed a bit in functionality from VS 2017 and later. Set the cursor on the class body (or declaration, i.e. public class MyClass...) and execute the same key strokes and you'll get "Generate Constructor" from the Quick Actions menu. Sometimes though it doesn't work and you have to press search Quick Actions and find it manually.

Sani Huttunen
  • 23,620
  • 6
  • 72
  • 79