views:

35

answers:

2

Is there a simple way in vb.net to mask a public property or method from the internal namespace? It would be helpful as a refactoring tool to isolate internal dependencies and perhaps to enforce a non-recursion policy for external services.

+1  A: 

No. Any property or method that's usable from the external world is usable from your internal project as well, by definition.

Some tools, such as Resharper, though, can simplify checking policies like this. For example, Resharper lets you view an entire list of call sites where a property or method is being used. You could use this to verify that nothing internal is using a specific method.

Reed Copsey
A: 

As Reed said, there is no way to do this in VB.Net (or C# for that matter).

Another approach you could take is to use multiple assemblies. Essentially put the two logical components into different assemblies and use that boundary as a means to enforce the policy at hand. You can even use a tool like ILMerge to combine the assemblies back into a single one at a later point.

JaredPar