Home > Net >  Why Does intellisense update like this
Why Does intellisense update like this

Time:11-20

I am creating some VB.NET modules in which work like so: Project name:CommonLib Namespace:uix Module:color I have the following:

Namespace uix
    Public Module color
        Private Property TextToColor As Dictionary(Of Drawing.Color, String)
        Sub New()

        End Sub
        Public Function SearchColor(color As String) As Drawing.Color
        End Function

    End Module
End Namespace

It allows the user to access like so:

CommonLib.uix.SearchColor()

Instead of:

CommonLib.uix.color.SearchColor()

CodePudding user response:

That's how modules work. You don't have to qualify their members with the type name. I believe this was done for compatibility with VB6 code, which works the same way. Without that behaviour, a lot of upgraded VB6 code would not have worked without qualifying types being added.

If you don't want that behaviour then create a class with Shared members instead of a module.

  • Related