PC Review


Reply
Thread Tools Rate Thread

C# namespace vs. vb.net

 
 
Jeff Jarrell
Guest
Posts: n/a
 
      14th Feb 2007
Correct me if I am wrong but doesn't C# handle the "root namespace" on the
project properties differently than vb.net?

In vb.net, I have setting the root namespace on the project properties.
Then for the most part I don't need an explicit namespace in each class. If
I do specify a namespace, then the root namespace is prepended to the
explicit one specified in the class.

Seems like in C#, if I am explicit in the file that is the namespace I get.
I don't seem where the root namespace on the project properties comes into
play. Yet I can't blank it out.

comments.

Thanks,
jeff


 
Reply With Quote
 
 
 
 
Jon Skeet [C# MVP]
Guest
Posts: n/a
 
      14th Feb 2007
Jeff Jarrell <(E-Mail Removed)> wrote:
> Correct me if I am wrong but doesn't C# handle the "root namespace" on the
> project properties differently than vb.net?
>
> In vb.net, I have setting the root namespace on the project properties.
> Then for the most part I don't need an explicit namespace in each class. If
> I do specify a namespace, then the root namespace is prepended to the
> explicit one specified in the class.
>
> Seems like in C#, if I am explicit in the file that is the namespace I get.
> I don't seem where the root namespace on the project properties comes into
> play. Yet I can't blank it out.
>
> comments.


Yes, in C# the source file has all the information in that's required.
Personally, I like that - there's no "hidden" information needed to
know what's going on.

--
Jon Skeet - <(E-Mail Removed)>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
 
Reply With Quote
 
=?Utf-8?B?RGF2aWQgQW50b24=?=
Guest
Posts: n/a
 
      14th Feb 2007
The only way that the 'default namespace' comes into play in C# is that the
designer will automatically insert that into new classes you create. It
doesn't have the 'hidden' behavior that the 'root namespace' has in VB.

It's kind of unfortunate that it's called "root namespace" in the .csproj
file, but in Visual Studio it's called 'default namespace' which is more
accurate.
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
Instant C++: C#/VB to C++ converter
Instant Python: C#/VB to Python converter


"Jeff Jarrell" wrote:

> Correct me if I am wrong but doesn't C# handle the "root namespace" on the
> project properties differently than vb.net?
>
> In vb.net, I have setting the root namespace on the project properties.
> Then for the most part I don't need an explicit namespace in each class. If
> I do specify a namespace, then the root namespace is prepended to the
> explicit one specified in the class.
>
> Seems like in C#, if I am explicit in the file that is the namespace I get.
> I don't seem where the root namespace on the project properties comes into
> play. Yet I can't blank it out.
>
> comments.
>
> Thanks,
> jeff
>
>
>

 
Reply With Quote
 
Jeff Jarrell
Guest
Posts: n/a
 
      15th Feb 2007
you are probably right. It wasn't readily apparent what vb was doing to me,
at least when I first started using namespaces.

thanks,
jeff

"Jon Skeet [C# MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Jeff Jarrell <(E-Mail Removed)> wrote:
>> Correct me if I am wrong but doesn't C# handle the "root namespace" on
>> the
>> project properties differently than vb.net?
>>
>> In vb.net, I have setting the root namespace on the project properties.
>> Then for the most part I don't need an explicit namespace in each class.
>> If
>> I do specify a namespace, then the root namespace is prepended to the
>> explicit one specified in the class.
>>
>> Seems like in C#, if I am explicit in the file that is the namespace I
>> get.
>> I don't seem where the root namespace on the project properties comes
>> into
>> play. Yet I can't blank it out.
>>
>> comments.

>
> Yes, in C# the source file has all the information in that's required.
> Personally, I like that - there's no "hidden" information needed to
> know what's going on.
>
> --
> Jon Skeet - <(E-Mail Removed)>
> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
> If replying to the group, please do not mail me too



 
Reply With Quote
 
PS
Guest
Posts: n/a
 
      15th Feb 2007
"Jon Skeet [C# MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Jeff Jarrell <(E-Mail Removed)> wrote:
>> Correct me if I am wrong but doesn't C# handle the "root namespace" on
>> the
>> project properties differently than vb.net?
>>
>> In vb.net, I have setting the root namespace on the project properties.
>> Then for the most part I don't need an explicit namespace in each class.
>> If
>> I do specify a namespace, then the root namespace is prepended to the
>> explicit one specified in the class.
>>
>> Seems like in C#, if I am explicit in the file that is the namespace I
>> get.
>> I don't seem where the root namespace on the project properties comes
>> into
>> play. Yet I can't blank it out.
>>
>> comments.

>
> Yes, in C# the source file has all the information in that's required.
> Personally, I like that - there's no "hidden" information needed to
> know what's going on.


And in VS2005 you can use the Rename refactoring to change it easily.

PS

>
> --
> Jon Skeet - <(E-Mail Removed)>
> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
> If replying to the group, please do not mail me too



 
Reply With Quote
 
Ben Voigt
Guest
Posts: n/a
 
      15th Feb 2007

"David Anton" <(E-Mail Removed)> wrote in message
news:61D15EF5-A2DA-44A9-BFAB-(E-Mail Removed)...
> The only way that the 'default namespace' comes into play in C# is that
> the
> designer will automatically insert that into new classes you create. It


It's also used for classes the build process creates (for embedded
resources, etc).

> doesn't have the 'hidden' behavior that the 'root namespace' has in VB.
>
> It's kind of unfortunate that it's called "root namespace" in the .csproj
> file, but in Visual Studio it's called 'default namespace' which is more
> accurate.
> --
> David Anton
> www.tangiblesoftwaresolutions.com
> Instant C#: VB to C# converter
> Instant VB: C# to VB converter
> Instant C++: C#/VB to C++ converter
> Instant Python: C#/VB to Python converter
>
>
> "Jeff Jarrell" wrote:
>
>> Correct me if I am wrong but doesn't C# handle the "root namespace" on
>> the
>> project properties differently than vb.net?
>>
>> In vb.net, I have setting the root namespace on the project properties.
>> Then for the most part I don't need an explicit namespace in each class.
>> If
>> I do specify a namespace, then the root namespace is prepended to the
>> explicit one specified in the class.
>>
>> Seems like in C#, if I am explicit in the file that is the namespace I
>> get.
>> I don't seem where the root namespace on the project properties comes
>> into
>> play. Yet I can't blank it out.
>>
>> comments.
>>
>> Thanks,
>> jeff
>>
>>
>>



 
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
type or namespace name 'MessageBox' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?) mp Microsoft C# .NET 8 18th Dec 2010 05:55 AM
The type or namespace name 'Generic' does not exist in the class or namespace 'System.Collections' pantagruel Microsoft C# .NET 1 23rd Oct 2007 12:07 AM
ERROR CS0234: The type or namespace name 'DataAccessHelper' does not exist in the namespace 'BCC' (are you missing an assembly reference?) li.eddie@gmail.com Microsoft ASP .NET 0 6th Jan 2006 11:31 AM
The type or namespace 'Installer' does not exist in the class or namespace 'System.Configuration' John Chrisman Microsoft C# .NET 2 18th Nov 2005 11:24 PM
The type or namespace name 'Windows' does not exist in the class or namespace 'System' (are you missing an assembly reference?) =?Utf-8?B?UmF5?= Microsoft Dot NET 1 7th Apr 2004 10:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:43 AM.