我有以下代码:
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
我想做的是能够分离代码,类似于以下(显然不起作用):
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
我想要一个类内部命名空间的功能,因为它可以让我调用 Step2.Execute() 而不必将 Step2_ 放在一大堆函数的前面。我不想为 step1、step2 等创建单独的类/模块。
有没有一种方法可以从类内部完成命名空间功能?