Hide 'empty' namespace from extarnal assemblies.

M

Michael S

Hi.

I am working on a class library where I have a namespace called
MyProject.Implementation.
This namespace only have internal and private classes.

However, when I use my .dll assembly in a WinForm application, that
application can still see the namespace via Intellisense. For the consumer
it appears to be an empty namespace.

As access modifiers are not allowed on namespaces, is there another way to
signal, to visual studio (or other tools), that the namespace should be
'invisible' to outside consumers? An attribute perhaps?

Best Regards
- Michael Starberg
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


Michael S said:
Hi.

I am working on a class library where I have a namespace called
MyProject.Implementation.
This namespace only have internal and private classes.

However, when I use my .dll assembly in a WinForm application, that
application can still see the namespace via Intellisense. For the consumer
it appears to be an empty namespace.

As access modifiers are not allowed on namespaces, is there another way to
signal, to visual studio (or other tools), that the namespace should be
'invisible' to outside consumers? An attribute perhaps?


The only attribute I know of for this is EditorBrowsable:

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]

not sure if you can apply it to a namespace though, you can try and post
back yor result :)
 
M

Michael S

Error 1 A namespace declaration cannot have modifiers or attributes
D:\Projects\coredc\trunc\Implementation\DcConnection.cs 9 1 CoreDC

Guess I have to live with the empty namespace. No big deal.

- Michael Starberg


Ignacio Machin ( .NET/ C# MVP ) said:
Hi,


Michael S said:
Hi.

I am working on a class library where I have a namespace called
MyProject.Implementation.
This namespace only have internal and private classes.

However, when I use my .dll assembly in a WinForm application, that
application can still see the namespace via Intellisense. For the
consumer it appears to be an empty namespace.

As access modifiers are not allowed on namespaces, is there another way
to signal, to visual studio (or other tools), that the namespace should
be 'invisible' to outside consumers? An attribute perhaps?


The only attribute I know of for this is EditorBrowsable:

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]

not sure if you can apply it to a namespace though, you can try and post
back yor result :)
 
B

Ben Voigt [C++ MVP]

Michael S said:
Error 1 A namespace declaration cannot have modifiers or attributes
D:\Projects\coredc\trunc\Implementation\DcConnection.cs 9 1 CoreDC

Guess I have to live with the empty namespace. No big deal.

How about using an internal static partial class instead of a namespace?
- Michael Starberg


Ignacio Machin ( .NET/ C# MVP ) said:
Hi,


Michael S said:
Hi.

I am working on a class library where I have a namespace called
MyProject.Implementation.
This namespace only have internal and private classes.

However, when I use my .dll assembly in a WinForm application, that
application can still see the namespace via Intellisense. For the
consumer it appears to be an empty namespace.

As access modifiers are not allowed on namespaces, is there another way
to signal, to visual studio (or other tools), that the namespace should
be 'invisible' to outside consumers? An attribute perhaps?


The only attribute I know of for this is EditorBrowsable:

[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]

not sure if you can apply it to a namespace though, you can try and post
back yor result :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top