Is it possible get the functionality of namespaces inside a class?

Posted by CowKingDeluxe on Stack Overflow See other posts from Stack Overflow or by CowKingDeluxe
Published on 2010-05-01T17:40:21Z Indexed on 2010/05/01 17:47 UTC
Read the original article Hit count: 207

I have the following code:

Public Class Form1
Private Function Step1_Execute() As Boolean
    Return Step1_Verify()
End Function

Private Function Step1_Verify() As Boolean
    Return True
End Function

Private Function Step2_Execute() As Boolean
    Return Step2_Verify()
End Function

Private Function Step2_Verify() As Boolean
    Return True
End Function
End Class

What I would like to do is be able to separate the code, similar to the following (which obviously doesn't work):

Public Class Form1

Namespace Step1
    Private Function Step1_Execute() As Boolean
        Return Step1_Verify()
    End Function

    Private Function Step1_Verify() As Boolean
        Return True
    End Function
End Namespace

Namespace Step2
    Private Function Step2_Execute() As Boolean
        Return Step2_Verify()
    End Function

    Private Function Step2_Verify() As Boolean
        Return True
    End Function
End Namespace

End Class

I would like the functionality of namespaces inside of a class, as in something that would let me call Step2.Execute() instead of having to put Step2_ in front of a whole bunch of functions. I don't want to have to create separate classes / modules for step1, step2, etc.

Is there a way that I can accomplish namespace functionality from inside a class?

© Stack Overflow or respective owner

Related posts about visual-studio

Related posts about ASP.NET