History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: RSRP-43048
Type: New Feature New Feature
Status: Open Open
Priority: Major Major
Assignee: Eugene Pasynkov
Reporter: Niels Ull Harremoës
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
ReSharper

Better reformatting of anonymous delegates

Created: 13 Jun 07 11:38   Updated: 13 Jun 07 16:03
Component/s: Code Cleanup
Fix Version/s: Future Versions
Security Level: Everybody (All jira users)

Original Estimate: Unknown Remaining Estimate: Unknown Time Spent: Unknown

Build: 456


 Description  « Hide
Reformatting this:
List<int> myList = new List<int>(new int[] {1, 2, 3, 4, 5});
List<int> evens= myList.FindAll(delegate(int obj){int x = obj; if (x%2 == 0) {return true;} else{ return false;}});

gives this:

List<int> myList = new List<int>(new int[] {1, 2, 3, 4, 5});
List<int> evens = myList.FindAll(delegate(int obj)
                                         {
                                           int x = obj;
                                           if (x%2 == 0)
                                           {
                                             return true;
                                           }
                                           else
                                           {
                                             return false;
                                           }
                                         });

This is not very pretty.
I would like an option to "prefer wrap before delegate" to get

List<int> myList = new List<int>(new int[] {1, 2, 3, 4, 5});
List<int> evens = myList.FindAll(
        delegate(int obj)
        {
          int x = obj;
          if (x%2 == 0)
          {
            return true;
          }
          else
          {
            return false;
          }
        });

I can't get the indentation quite right, but I hope you get the idea - wrap the line before the delegate, if it's too long to fit on one line.



 All   Comments   Work Log   Change History      Sort Order:
There are no comments yet on this issue.