PC Review


Reply
Thread Tools Rate Thread

The difference about namespace between VB.NET and C#

 
 
ad
Guest
Posts: n/a
 
      18th Mar 2005
Is there any difference about namespace between VB.NET and C#.



All functions in c# must include in a namespace.

Why I can't find namespace in the files .vb .

How VB.NET implement the concept of namespace


 
Reply With Quote
 
 
 
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      18th Mar 2005
Ad,
> Is there any difference about namespace between VB.NET and C#.

No! As namespace is a CLR construct used to groups types.

> Why I can't find namespace in the files .vb .

VB.NET projects normally set the Root namespace property under the Project
Properties dialog.

While C# normally leaves the Root namespace property blank under the Project
Properties dialog.

Hope this helps
Jay

"ad" <(E-Mail Removed)> wrote in message
news:%23$(E-Mail Removed)...
> Is there any difference about namespace between VB.NET and C#.
>
>
>
> All functions in c# must include in a namespace.
>
> Why I can't find namespace in the files .vb .
>
> How VB.NET implement the concept of namespace
>
>



 
Reply With Quote
 
ad
Guest
Posts: n/a
 
      18th Mar 2005
Thank!
But, Why the vb project still can compile after I delete the root namespace
in the project properties dialog,
and I did not add namepace in the codes, so that there are no namespace in
my vb projec?


"Jay B. Harlow [MVP - Outlook]" <(E-Mail Removed)> 撰寫於郵件新聞
:(E-Mail Removed)...
> Ad,
> > Is there any difference about namespace between VB.NET and C#.

> No! As namespace is a CLR construct used to groups types.
>
> > Why I can't find namespace in the files .vb .

> VB.NET projects normally set the Root namespace property under the Project
> Properties dialog.
>
> While C# normally leaves the Root namespace property blank under the

Project
> Properties dialog.
>
> Hope this helps
> Jay
>
> "ad" <(E-Mail Removed)> wrote in message
> news:%23$(E-Mail Removed)...
> > Is there any difference about namespace between VB.NET and C#.
> >
> >
> >
> > All functions in c# must include in a namespace.
> >
> > Why I can't find namespace in the files .vb .
> >
> > How VB.NET implement the concept of namespace
> >
> >

>
>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      19th Mar 2005
"ad" <(E-Mail Removed)> schrieb:
> But, Why the vb project still can compile after I delete the root
> namespace
> in the project properties dialog,
> and I did not add namepace in the codes, so that there are no namespace in
> my vb projec?


This will generate a namespace without a name.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

 
Reply With Quote
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      19th Mar 2005
Ad,
Namespaces are not required or as Herfried suggests you can have an unnamed
namespace. As namespaces are simply an organization feature to avoid name
collisions.

In other words in both C# & VB.NET you can leave the root/default namespace
blank, and not to include a namespace statement in the source files. In both
cases you will have an unnamed namespace in the generated assembly.


>> While C# normally leaves the Root namespace property blank under the

> Project
>> Properties dialog.

Doh! Technically C# uses a "Default namespace" that is used when adding new
types. Changing this default namespace does not change existing types.

Hope this helps
Jay

"ad" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thank!
> But, Why the vb project still can compile after I delete the root
> namespace
> in the project properties dialog,
> and I did not add namepace in the codes, so that there are no namespace in
> my vb projec?
>
>
> "Jay B. Harlow [MVP - Outlook]" <(E-Mail Removed)> 撰寫於郵件新聞
> :(E-Mail Removed)...
>> Ad,
>> > Is there any difference about namespace between VB.NET and C#.

>> No! As namespace is a CLR construct used to groups types.
>>
>> > Why I can't find namespace in the files .vb .

>> VB.NET projects normally set the Root namespace property under the
>> Project
>> Properties dialog.
>>
>> While C# normally leaves the Root namespace property blank under the

> Project
>> Properties dialog.
>>
>> Hope this helps
>> Jay
>>
>> "ad" <(E-Mail Removed)> wrote in message
>> news:%23$(E-Mail Removed)...
>> > Is there any difference about namespace between VB.NET and C#.
>> >
>> >
>> >
>> > All functions in c# must include in a namespace.
>> >
>> > Why I can't find namespace in the files .vb .
>> >
>> > How VB.NET implement the concept of namespace
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Namespace conflicts with page class - name resolution difference in compiler Shadow Lynx Microsoft ASP .NET 1 4th Feb 2006 04:17 PM
Is there any difference about namespace between VB.NET and C#. ad Microsoft C# .NET 4 18th Mar 2005 11:52 PM
Namespace aliases notation, why the difference Microsoft C# .NET 4 19th Dec 2003 11:37 PM
Placing using before namespace{} or in namespace{} - What's the difference? Empire City Microsoft C# .NET 2 18th Nov 2003 06:18 AM
Perf difference between importing a namespace and wrting the fully qualified name in code? BH Microsoft C# .NET 1 27th Jul 2003 05:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:55 PM.