How to create project w/o a namespace

  • Thread starter Thread starter tired_of_spaghetti
  • Start date 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
 
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.
 
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
 
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.
 
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.
 
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.
 
Back
Top