This documentation is archived and is not being maintained.

DefaultNamespace Property (Visual Basic and C# Project Object)

Visual Studio .NET 2003

Returns or sets the namespace for items added through the Add New Item Dialog Box.

[Visual Basic .NET]
Public Property DefaultNamespace() As String
[Visual Basic 6]
Property Get DefaultNamespace() As String
Property Let DefaultNamespace( _
   ByVal NewValue As String _
HRESULT __stdcall get_DefaultNamespace(
   /* [out, retval] */ BSTR* retVal
HRESULT __stdcall put_DefaultNamespace(
   /* [in] */ BSTR NewValue
string DefaultNamespace {get; set;}
[JScript .NET]
public function get DefaultNamespace() : String
public function set DefaultNamespace(
   NewValue : String


The namespace to be used for new project items.


In a Visual Basic project, all items in the project will have their namespace changed when the DefaultNamespace property is changed. In a Visual C# project, only new items carry the new namespace when the DefaultNamespace property is changed.

For new projects, the DefaultNamespace is the same as the project file name without extension. Spaces in the project name are replaced with the underscore character, "_".

The namespace can be any legal identifier. For more information, see 2.4.2 Identifiers (Visual C#) and 2.2 Identifiers (Visual Basic).


See ProjectType Property.

See Also

General, Common Properties, <Projectname> Property Pages Dialog Box (Visual Basic) | General, Common Properties, <Projectname> Property Pages Dialog Box (C#)

Applies To: Properties Property (General Extensibility) | Properties Property (Visual Basic and Visual C# Project Object)