This is a migrated thread and some comments may be shown as answers.

Object Initializer Code Style

1 Answer 35 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Ashot
Top achievements
Rank 1
Ashot asked on 22 Mar 2014, 01:59 AM
I want JustCode formats object initializers in my code like below:
var endpoint = new Endpoint { Address = address,
                          Port = port };

​How I can set up code style options for this?

1 Answer, 1 is accepted

Sort by
0
Rumen
Telerik team
answered on 27 Mar 2014, 10:46 AM
Hi,

Unfortunately your formatting is not supported by JustCode.
​Our formatter will not let the opening brace to be on the first line of a multiline block and the closing brace to be on the last line of a multiline block.

However, I would like to suggest a formatting that JustCode supports and looks closest to your request:

Endpoint endpoint = new Endpoint {
    Address = address,
    Port = port
};

You can achieve this result with the following option:
Code Style -> C# -> Brace Positions -> Array, object and collection initializer = Same Line

We design our formatting settings according to the most widely used conventions.
The community decides which are the most widely used conventions.
Therefore, you can make us implement your feature by suggesting it in our feedback portal - http://feedback.telerik.com/Project/100/Feedback/List/All%20Feedback

Regards,
Rumen
Telerik
 

Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

 
Tags
General Discussions
Asked by
Ashot
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or