Just a quick question: I want only one class of my assembly to be public and everything else invisible to the outside. Do I just set all other classes with their methods and properties to internal? Is this even a good approach?
All classes by default are internal
. So if you want them to be public
you have to state this.
So you can make the single class you want to be public as public and mark the rest of them as internal
, since that enhance the readability of your code, as Silvermind has pointed out in his comment.
When a class is internal
it can be accessed only by types in the same assembly. That being said, you have to decide if the methods of a type, which is internal are going to be used by other types inside the same assembly or not. If a method will not be called by another type, then you have to declare it as a private
, otherwise as a public
. The same holds for the properties. Furthermore a class member can also be protected
. For more inofrmation on the latter, please have a look here.