我记得教授告诉他以下是不好的做法.但它使得逐步执行代码变得不那么繁琐.我只是在征求关于利弊的评论:
Friend Class MyClass Private isEmpty As Boolean Public Property IsEmpty() As Boolean Get Return isEmpty End Get Set(ByVal Value As Integer) isEmpty = value End Set End Property Public Sub MyMethod() ''//Is this more correct: If Me.IsEmpty() Then ''//Do something. End If ''//Is this bad practice?: If isEmpty Then ''//Do something. End If End Sub End Class