在Visual Studio(或Resharper)中是否有一个设置允许您指定哪些命名空间应该是默认的,以及它们放入的范围?停止Visual Studio在命名空间外放置使用指令
默认为MVC项目的例子是
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Namespace
{
public class Class1
{
}
}
但ReSharper的和抱怨了StyleCop:
所有使用指令必须放置在命名空间内。 [规则StyleCop的:SA1200]
使用指令不需要通过代码,可以安全删除
有没有一种方法,使简单的默认:
namespace Namespace
{
public class Class1
{
}
}
是的,你可以编辑类模板; http://stackoverflow.com/questions/2072687/how-do-i-edit-the-visual-studio-templates-for-new-c-sharp-class-interface – 2014-10-29 11:36:58
@AlexK。谢谢。投票关闭这个作为愚蠢:) – 2014-10-29 11:40:18
@dav_i:答案可能是重复的 - 但我猜你不知道模板存在?所以基于这个事实可能值得保留这个问题。 – Ian 2014-10-29 11:43:42