C# (Sharp) Programming Language Question:

Is it possible to restrict the scope of a field/method of a class to the classes in the same namespace?

C# (Sharp) Programming Language Interview Question
C# (Sharp) Programming Language Interview Question

Answer:

There is no way to restrict to a namespace. Namespaces are never units of protection. But if you're using assemblies, you can use the 'internal' access modifier to restrict access to only within the assembly.


Previous QuestionNext Question
Why cannot you specify the accessibility modifier for methods inside the interface?Why do I get a syntax error when trying to declare a variable called checked?