How to create project w/o a namespace

  • Thread starter tired_of_spaghetti
  • Start date
T

tired_of_spaghetti

Hi - I am trying to create a project w/o a default namespace but can't
seem to get the hang of it ... Any help appreciated.

Happy New Years,
El Squid
 
F

Family Tree Mike

Hi - I am trying to create a project w/o a default namespace but can't
seem to get the hang of it ... Any help appreciated.

Happy New Years,
El Squid

That seems like a weird goal, so I may be misunderstanding your desire.

I don't think you can change the Default Namespace property to "", or
nothing. You can delete the Namespace XXX {} from your code.
 
P

Peter Duniho

Hi - I am trying to create a project w/o a default namespace but can't
seem to get the hang of it ... Any help appreciated.

As Mike says, it's hard to understand what exactly you're trying to do.

Every type in C# must be in a namespace. What would the point of
eliminating the default namespace from the project be? How is having a
default namespace causing a problem for you?

Pete
 
D

David Anton

Types in C# do not need to be in a namespace.
For a small app which does not expose anything publicly, having everything
in the same namespace doesn't accomplish anything - that extra 'wrapper' is
not required.
 
F

Family Tree Mike

Just blank out the 'Default namespace' on the project properties dialog.

In VS 2008 Express and VS 2010 Express Beta 2, this gives the message
"The entered value for the property 'Default Namespace' is invalid.
 
D

David Anton

Strange - I have a project started in VS 2005 and it allowed a blank default
namespace and the upgrade to VS 2008 left it blank.

For a new project, you can just manually edit the .csproj file so the the
'RootNamespace' xml entry is blank.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top