Re: Private Namespace in VB.NET by Robert
Robert
Wed Sep 29 12:52:37 CDT 2004
Joshua Frank wrote:
> Right, you can make all the classes Friend, and they won't show up in
> the Object Browser. But the namespace does. The empty namespace
> doesn't do much harm, but it's untidy.
Namespaces don't exist in IL, nor do they exist in metadata.
They are just "shortcuts", that save us some time while typing
boring stuff like
ACME.Stuff.Util.Net.MultiSocket s = new
ACME.Stuff.Util.Net.MultiSocket();
Because they don't exist you cannot mark them hidden/private
whatever.
bye
Rob
>
> Jay B. Harlow [MVP - Outlook] wrote:
>
>> Jonathan,
>> As you may know you can only put private classes inside another Class
>> or Structure.
>>
>> The best you can do is make all the classes in "mystuff.private"
>> Friend, which then requires the namespace be written to the assembly,
>> exposing the namespace...
>>
>> Interesting thought though, I had to try it to very verify it.
>>
>> Hope this helps
>> Jay
>>
>>
>> "Jonathan Allen" <x@x.x> wrote in message
>> news:OJyvuDbpEHA.3500@TK2MSFTNGP15.phx.gbl...
>>
>>> If you create a namespace "mystuff.private" and all the classes in it
>>> are
>>> private, will anyone else ever see it?
>>>
>>> I don't think they will, because the tools should not list empty
>>> namespaces.
>>> Try it and see what happens.
>>>
>>> --
>>> Jonathan Allen
>>>
>>>
>>> "Joshua Frank" <jfrank.removeluncheonmeat@archimetrics.com> wrote in
>>> message
>>> news:usuIXxYpEHA.1296@TK2MSFTNGP12.phx.gbl...
>>>
>>>> Hi All,
>>>>
>>>> Is it possible to have a private namespace in VB? When I try it I get
>>>> this error:
>>>>
>>>> "Specifiers and attributes are not valid on 'Namespace' statements."
>>>>
>>>> I have a few reasons for wanting this; the most annoying one is that if
>>>> you add a web reference to your project, VS creates the proxy
>>>> objects in
>>>> a namespace that you specify. Because namespaces are always public,
>>>> this then appears in the object browser as part of the component. But
>>>> this is annoying, because I don't want the internal implementation
>>>> details (i.e., that my component uses a web service) visible like this.
>>>> Namespaces are just an organizational convenience for the programmer;
>>>> I can't think of a reason why you shouldn't be able to make one public.
>>>> Any ideas on this one? Thanks in advance.
>>>>
>>>> Cheers,
>>>> Josh
>>>
>>>
>>>
>>
>>