Visual Basic .NET/Namespaces
Namespaces
edit
Namespaces allows to separate the different imported programs, especially when they are long like libraries.
In a module, simply enter (without any module name):
Namespace Packet1
Class ExternalClass
Public Name As String = "Default"
End Class
End Namespace
To import them after, use Imports
.
For example from another module of the project ConsoleApplication1:
Imports ConsoleApplication1.Packet1
Module Module1
Sub Main()
Dim LocalName = New ExternalClass
Console.WriteLine(LocalName.Name)
Console.ReadLine() ' Displays "Default"
End Sub
End Module
By commenting the importation line, the following error appears: ExternalClass Type undefined.