Need Help with Code Formatting
Answered
I have a few scenarios I cannot figure out how to apply:
1. If initializing local variable, then chop if chained calls:
Currently:
var returnValue = RefDataContainer.FcmCaseTypes.OrderBy(x => x.DisplayOrder)
.Select(c => new RefDataDto
{
Text = c.FcmCaseName
, Value = c.Id.ToString()
, Enabled = c.Enabled
})
.ToArray();
Desired:
var returnValue =
RefDataContainer
.FcmCaseTypes
.OrderBy(x => x.DisplayOrder)
.Select(c => new RefDataDto
{
Text = c.FcmCaseName,
Value = c.Id.ToString(),
Enabled = c.Enabled
})
.ToArray();
2. If initializing local variable with object initializer, Chop Always.
Current:
var response = new ResponsePackage<RefDataDto[]>
{
IsSuccessfull = true, Timestamp = DateTime.Now, Value = returnValue
};
Desired:
var response =
new ResponsePackage<RefDataDto[]>
{
IsSuccessfull = true,
Timestamp = DateTime.Now,
Value = returnValue
};
Please sign in to leave a comment.
Hello Ninja,
Thank you for contacting us.
Here's a corresponding feature request about the first case - https://youtrack.jetbrains.com/issue/RSRP-469390
Feel free to comment or vote for it.
For the second case, you can configure your own code-formatting rules.
To do so, select
ReSharper | Options | Code Editing | General Formatting Style | Line Breaks and wrapping
.You need a setting
Arrangement of initializers
.Choose
Chop always
at theWrap object and collection initializer
setting.Here you can read more about code-formatting rules.
Let me know if you have any questions.