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

Re: Private Namespace in VB.NET by Marina

Marina
Tue Sep 28 14:37:26 CDT 2004

If the namespace is only applicable to that project - then why bother
creating it at all? Why not put the classes you would have put in there,
into one of the public namespaces in the project? As long as the classes
are marked as for the current assembly only, they should not show up
elsewhere.

"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



Re: Private Namespace in VB.NET by Joshua

Joshua
Tue Sep 28 14:51:11 CDT 2004

Agreed, but certain tools, like the web service proxy creator I
mentioned, auto generate code and put it in a namespace, so you don't
have the control that you need to do this. But also, once in a while it
would be nice to use a namespace for its intended purpose (i.e.,
organizing code) without publicizing this fact to everyone else.

Marina wrote:

> If the namespace is only applicable to that project - then why bother
> creating it at all? Why not put the classes you would have put in there,
> into one of the public namespaces in the project? As long as the classes
> are marked as for the current assembly only, they should not show up
> elsewhere.
>
> "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
>
>
>

Re: Private Namespace in VB.NET by Jonathan

Jonathan
Tue Sep 28 17:52:31 CDT 2004

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



Re: Private Namespace in VB.NET by Jay

Jay
Tue Sep 28 21:18:03 CDT 2004

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
>
>



Re: Private Namespace in VB.NET by Joshua

Joshua
Wed Sep 29 09:30:53 CDT 2004

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.

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
>>
>>
>
>

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
>>>
>>>
>>>
>>
>>