Is there a fast way to remove braces in VS 2010?
For example I have this code:
if (cond) {
lock (locker) {
foreach (var item in list) {
callFunc(item);
}
}
}
开发者_如何学C
And I now want to remove all those brackets because they are too redundant. I always do it manually but I find myself doing this often so was wondering if there's a shortcut I missed or easy way to do this. Google didn't find anything.
There seems to be no such option in Visual Studio. You could download JetBrains Resharper, a great plugin for Visual Studio that allows you to (among many other things) specify the code format you like with indentation, braces layout etc. Then you just run the reformat code command.
A word of warning: once you start using ReSharper you will become addicted and be completely unable to work without it. :)
I am not aware of such a shortcut, but I also dun believe there exists one. The only better way I can think of is by using the search & replace feature. But I doubt you are already using that anyway.
I think, the best way would be to write a python script to do this. (or with any other language that's easy to manipulate text with).
精彩评论