开发者

Resharper Tip/Trick... is this possible?

How can I have Resharper convert code file like

using Stuff;
using Stuff.MoreStuff;
using Stuff.MoreStuff.EvenMoreStuff;

namespace CoolStuff 
{
// src code
}

To

namespace CoolStuff 
{
  #region Using Statements
  using Stuff;
  using Stuff.MoreStuff;
  using Stuff.MoreStuff.EvenMoreStu开发者_Python百科ff;
  #endregion

// src code
}

I just like it this way, it "I think" is in one of the stylecop rules too. I would appreciate any kind of help.

Thanks


In your ReSharper Options, find the Namespace Imports page under C#->Formatting Style. In there, check the "Add using directive to the deepest scope" check box.

Then, go down to the bottom Tools section, and select the Code Cleanup page. Create a new cleanup profile, and check the "Embrace 'using' directives in region" option, supplying "Using Statements" as the region name on the next line. Make sure that "Optimize 'using' directives" is checked. You can turn the other cleanup settings on or off as you like.

Then, you can run code cleanup on a file by pressing Ctrl+E, C (or Ctrl+E, F if you've set that profile as your silent clean-up profile).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜