Make C# namespace internal

Tags: .NET

It’s very common that you want to hide some of your code, so that people who are using your library can’t directly use some of your classes and methods. But one step above, you have your self-defined namespaces and then comes the question: “How do I make my namespace internal?”

It is impossible to add an identifier to your namespace. The solution to this problem is making all the namespace members internal. When referencing to this library you won't see the namespace itself anymore. However if you add the library project (so with your code) to your solution instead of adding a reference to the library, you still see the namespace popping (this without any members since they are all internal).

Comments

comments powered by Disqus