When do we need to use directives inside the namespace scope?

I don’t know why the Asp.net MVC developers put the directives usingin the namespace System.Web.Mvcas 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 place directives usinginside an area namespace?

+3
source share
2 answers

This is your choice. The StyleCop tool warns of this as best practice, but the files created in Visual Studio always have use outside of the namespace.

?

+2

Source: https://habr.com/ru/post/1792719/


All Articles