views:

29

answers:

2

I like to insert all members of a object automatically, so I dont need to type them (or even click them). Ctrl+J gives me the dropdown, but I like them all in code with a default value,

MyObject.Member1=0;

MyObject.Member2="";

MyObject.Member3=0;

Any Add-In or existing shortcut that can help me with that?

/Edit : I like to have the above generated automatically, so that I just need to put each default value there by myself.

A: 

You can create a constructor or another method that preforms a setter on multiple fields for you.

Kevin Crowell
It's for db-objects which I like to initialize with default values from code, they have quite a number of properties and I would find it conveniant to have some code generation thingy add all properties for me.
joeriks
@joeriks So whats to stop you creating a method in your class that does this for you? I don't see what you are getting at.
Kevin Crowell
Laziness :-) if I have a db table with 100 columns that I need to add some default values for in my object initializer I could write each column name by hand ... or use Ctrl+J to get the list and click each member ... but I'm sure someone made a Visual Studio tool for this, to reduce the need of repetitive and boring code writing. I would let the code generator create the 0 or null values, and then I would go through them and change to the appropriate default value (could be whatever value and different for each prop).
joeriks
A: 

I think the answer is there's no such thing available at the moment. ReSharper team suggested me to write a feature wish to them.

joeriks