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

Formatting LINQ

1 Answer 62 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.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 15 Apr 2011, 12:09 PM
I have found myself writing code like this a lot lately...
foldersToBeUpdated.Where(f=>blah).Select.(f=> MoreBlah).ToList().Foreach(f=> {
f.Something = somethingelse;
f.foo = bar;
     });

Sometimes the statements can go on a bit. So, to make it a bit more readable, I've been doing this...
foldersToBeUpdated
    .Where(f=>blah)
    .Select.(f=> MoreBlah)
    .ToList()
    .Foreach(f=>{
                f.Something = somethingelse;
                f.foo = bar;
            });
 (Format painter is messing with the spacing inside the {} brackets).

However, JC, when asked to format the code turns it in to this ...
foldersToBeUpdated
.Where(f=>blah)
.Select.(f=> MoreBlah)
.ToList()
.Foreach(f=>
         {
     f.Something = somethingelse;
     f.foo = bar;
   });

I would have thought that the 2nd and subsequent lines of the LINQ statement should have been indented below the first.

Hardly the end of the world, I know, but...

-- 
Stuart


1 Answer, 1 is accepted

Sort by
0
Blagoev
Telerik team
answered on 26 Apr 2011, 11:16 AM
Hello Stuart Hemming,
We are planning on improving the formatter for the next release this problem is high on our list. Hopefully it will be included in our future internal builds

Best wishes,
Blagoev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Blagoev
Telerik team
Share this question
or