In VB.NET, you can also create your own namespaces.
Structure of User Defined Namespace
Namespace mynamespace
Class Myclass1
..................
End Class
Class Myclass2
..................
End Class
End namespace
Example [MyNamespace.vb]
Imports System
'User defined namespace with two classes
Namespace mynamespace
Class myclass1
Sub New()
Console.WriteLine("In constructor of myclass1")
End Sub
End Class
Class myclass2
Sub New()
Console.WriteLine("In constructor of myclass2")
End Sub
End Class
End Namespace
Module Module1
Sub Main()
'Access class via its namespace
Dim m As mynamespace.myclass1
m = New mynamespace.myclass1()
End Sub
End Module
0 comments:
Post a Comment