【发布时间】:2014-09-09 19:24:14
【问题描述】:
我目前正在创建我的应用程序,我想编写一个易于理解的代码。 我想知道何时创建程序。如果我创建了很多它会影响我的应用程序的性能。
这是我的示例:
示例代码:
带子
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Greetings()
End Sub
Private sub Greetings()
MessageBox.Show("Hello!")
MessageBox.Show("To")
MessageBox.Show("My")
MessageBox.Show("World")
End
在上面的例子中,假设这个 sub 在整个应用程序中只会被调用 1 - 2 次。我喜欢轻松理解我的代码。
对比
没有子
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
MessageBox.Show("Hello!")
MessageBox.Show("To")
MessageBox.Show("My")
MessageBox.Show("World")
End Sub
在上面的例子中,这段代码我太费时间理解了。
【问题讨论】: