I don't know why Asp.net MVC developers put the using
directives inside System.Web.Mvc
namespace as follows.
namespace System.Web.Mvc
{
using System;
using System.Collections.ObjectModel;
[Serializable]
public class ModelErrorCollection : Collection<ModelError>
{
public void Add(Exception exception)
{
Add(new ModelError(exception));
}
public void Add(string errorMessage)
{
Add(new ModelError(errorMessage));
}
}
}
When do we need to put using
directives inside a namespace
sco开发者_StackOverflow中文版pe?
See Should 'using' statements be inside or outside the namespace?
It's your choice. StyleCop tool warns of it as a best practice, however Visual Studio generated files always have usings outside namespace.
Should all the using directives for namespaces be inside the namespace?
精彩评论