Hide 'empty' namespace from extarnal assemblies.

  • Thread starter Thread starter Michael S
  • Start date Start date
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
 
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 :)
 
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 :)
 
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 :)
 
Back
Top