"Convert to initializer" refactoring puts all member assignments on one line making the code harder to read when there are a lot of properties.
Proposed Solution:
Provide a user defined threshold setting above which member assignments are each done on a new line, this would make object initialisers with a lot of member assignments easier to read.
original code:
var foo = new bar();
foo.A = 0;
foo.B = 1;
foo.C = 2;
with threshold = 4:
var foo = new bar { A = 0, B = 1, C = 2 }; //as it is currently implemented
with threshold = 3:
var foo = new bar
{
A = 0,
B = 1,
C = 2
};
We have closed this ticket because another page addresses its subject:
CodeGen - Add options to specify code generation rules
Hi Eamon,
Thank you for the suggestion.
A more general feature request is already registered in our database:
ID: S19229, CodeGen - Add options to specify code generation rules
So, I've marked this suggestion as its duplicate, and we'll consider implementing the functionality you suggested in the context of this suggestion. I've added the corresponding note to this item.
Thanks,
Vito