Home > OS >  VS2022 Quick add class
VS2022 Quick add class

Time:02-28

I've bound ALT INS to "Add Class" in VS (version 2019 and it remembered it for 2022 as well). But it opens the old clunky "add file" dialog with class preselected, which is slow. I like the R# way where it just adds a file straight into your solution explorer. I know there are Marketplace addons that do something similar; the Mads K one still seems to give a dialog. I want to be faster than a dialog. Before I write my own extension, did I miss if this is a feature now in VS2022? If not, is there a good extension that does the R# thing? No, installing R# is not an option, I only have 128Gb of memory on this Desktop unfortunately.

CodePudding user response:

Outside of using ReSharper or writing your own extension the only option is to go with TDD route e.g.

var customer = new Customer();

Where Customer does not exist. Pressing CTRL . to get either Generate class Customer in new file or Generate new type.

Option 1 is closest to what you are after.

Option 2 seems like Generate new type is the better option as one can indicate an existing or non-existing path which Visual Studio will generate rather than the first option which places the new file in the current path be it the project root folder or a sub-folder.

  • Related