C# class in a directory without having the directory name in its namespace

Posted by PaN1C_Showt1Me on Stack Overflow See other posts from Stack Overflow or by PaN1C_Showt1Me
Published on 2010-05-18T09:16:07Z Indexed on 2010/05/18 9:20 UTC
Read the original article Hit count: 223

Filed under:
|
|
|
|

Hi !

If you add a directory in your Visual Studio project and you add a class inside it, the namespace will respect the whole path the directory inclusive.

But sometimes, I prefer having the class in the main project namespace, although it lies in a directory structure, just because I don't want to have mess in my code. So often happens that I rewrite the Myproject.MyDirectory namespace to be Myproject only.

Is it OK in your opinion? Or does any convention say that every class inside the directory must have it included in the namespace ?

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about namespace