By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,928 Members | 1,810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,928 IT Pros & Developers. It's quick & easy.

namespaces and directory structure

P: n/a
when creating a project with namespace like:
wrox.csharp.basics.overflowtest
is it good practice to have the directory structure like that also:
c:\wrox\csharp\basics\overflowtext.cs

Also if it is then is there a way to make visual studio set it up for
me as i'm creating the cs files? or do i have to first create the
directory structures and then as i save files save them in the correct
places depending on the namespace i create.
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
soni29,

Generally, I like to do that as well. However, I found it difficult to
perform generic operations on the projects in VS.NET, so I flattened my
directory structure out so that the directory name is the full namespace.
So, in my main directory, I have:

Casper
Casper.Net
Casper.Windows.Forms
etc.
etc.

You ^might^ be able to have VS.NET do this for you by modifying the
common.js file that is in the C# program directory under the VS.NET
directory. There are a number of templates that are used for new items.
You could modify the template/script for a new class to create the directory
based on the namespace.

However, this will most likely not work, because the namespace defaults
when the file is created, and determining when the namespace changes in the
editor and then moving the file will require a lot of work (you would have
to create the directory structure, move the file, and update the project
file).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"soni29" <so****@hotmail.com> wrote in message
news:ca**************************@posting.google.c om...
when creating a project with namespace like:
wrox.csharp.basics.overflowtest
is it good practice to have the directory structure like that also:
c:\wrox\csharp\basics\overflowtext.cs

Also if it is then is there a way to make visual studio set it up for
me as i'm creating the cs files? or do i have to first create the
directory structures and then as i save files save them in the correct
places depending on the namespace i create.

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.