KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
When the list of arguments to a method grows to the point where they do not fit comfortably on one line, I like to format code such that each argument is on a separate line (following the StyleCop suggestion), like this: public void MyMethod( int someArgument, double someOtherArgument, int someMoreArguments) The problem I run into is that this formatting is "fragile" and does not get automatically reformatted when using Ctrl + K + D . For instance, if I happen to insert some spaces in front of one of the arguments, it doesn't get removed, and I end up doing some tedious manual reformatting. If I copy a method (say, to provide an overloaded signature), the argument indentation in the copy gets totally messy. I have a similar issue with LINQ statements, which I also like to format on multiple lines, like: myEnumerable. .Where(this and that) .Where(this and that) .FirstOrDefault(); I realize this is complete obsessive-compulsive formatting, and a very minor issue, but is there a way to make Visual Studio 2010 automatically reindent multi-line arguments following that pattern when it gets misaligned?
Tags (comma-separated)
Save Edits
Cancel