PC Review


Reply
Thread Tools Rate Thread

class / namespace hierarchy issue - don't want same name twice

 
 
Zytan
Guest
Posts: n/a
 
      11th May 2007
I want to have a Win32 class (to dump my win32 dll imports in). I
want this in it's own directory Win32 in the solution explorer (since
I have other classes to put in this folder), which makes Win32 a
namespace. So, this ends up with:

MyProgramName.Win32.Win32.SendMessage
MyProgramName.Win32.AnotherClass.SomeWrapper

MyProgramName = my program's name
(1st) Win32 = namespace made from the folder
(2nd) Win32, AnotherClass = class names
SendMessage, SomeWrapper = methods

Is this proper? I'd rather have only one Win32 in the first example,
but that implies the namespace and classname must be one, which makes
no sense. I believe I've seen this exact thing in the .NET framework,
and I believe I was warned about how this appears strange to newbies,
so I think it is proper.

any thoughts welcome,
Zytan

 
Reply With Quote
 
 
 
 
Nicholas Paldino [.NET/C# MVP]
Guest
Posts: n/a
 
      11th May 2007
The namespace is dictated in the file that the class is defined in, not
the directory that the file is in. You can place whatever classes in
whatever directories you wish, and then make the namespace anything you
wish. There doesn't have to be any correlation between the two.

Perhaps you should think of another classname other than the namespace
name? Also, if you are providing a managed wrapper for windows apis, this
naming convention will probably help:

http://msdn2.microsoft.com/en-us/library/btadwd4w(vs.80).aspx

--
- Nicholas Paldino [.NET/C# MVP]
- (E-Mail Removed)

"Zytan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I want to have a Win32 class (to dump my win32 dll imports in). I
> want this in it's own directory Win32 in the solution explorer (since
> I have other classes to put in this folder), which makes Win32 a
> namespace. So, this ends up with:
>
> MyProgramName.Win32.Win32.SendMessage
> MyProgramName.Win32.AnotherClass.SomeWrapper
>
> MyProgramName = my program's name
> (1st) Win32 = namespace made from the folder
> (2nd) Win32, AnotherClass = class names
> SendMessage, SomeWrapper = methods
>
> Is this proper? I'd rather have only one Win32 in the first example,
> but that implies the namespace and classname must be one, which makes
> no sense. I believe I've seen this exact thing in the .NET framework,
> and I believe I was warned about how this appears strange to newbies,
> so I think it is proper.
>
> any thoughts welcome,
> Zytan
>



 
Reply With Quote
 
Zytan
Guest
Posts: n/a
 
      12th May 2007
> The namespace is dictated in the file that the class is defined in, not
> the directory that the file is in. You can place whatever classes in
> whatever directories you wish, and then make the namespace anything you
> wish. There doesn't have to be any correlation between the two.


Yes, I know. But since the IDE does this for me when I create new
files in the solution explorer folders, I figured that I'd follow
suit. Also, since when you delete a file from solution explorer it
deletes the file from the HD as well! So, it seems that they really
want us to follow suit! (Which make it difficult to deal with if you
update your program on more than one PC, and bring it back and forth,
unless you copy the whole directory each time)

> Perhaps you should think of another classname other than the namespace
> name?


Perhaps I should. But, I am correct when I say that even the NET
framework uses the same name sometimes, right? So, it's not so bad, I
think. But, yes, there may be a better way.

> Also, if you are providing a managed wrapper for windows apis, this
> naming convention will probably help:
>
> http://msdn2.microsoft.com/en-us/library/btadwd4w(vs.80).aspx


Ok, thanks!

Zytan

 
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
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
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
Should namespace hierarchy reflect the folder hierarchy on the disk HalcyonWild Microsoft C# .NET 5 14th Nov 2005 03:20 PM
Namespace hierarchy chart Daniel Microsoft Dot NET Framework 1 7th Jul 2005 01:10 PM
(namespace) class Hierarchy Chart for .net 2.0 Mukund Patel Microsoft ASP .NET 0 31st Dec 2004 02:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:19 AM.