List Object はコンストラクタで作成するのと、クラス変数定義域で作成するのとではどちらがよいでしょうか? 彼らは結局同じことをするのですか?ある方法が他の方法よりも優先されるのはいつですか?
クラス定義の例を次に示します。
Public Class CProject
'Variable to hold a list of Load Objects, Instantiate here vs in New().
Private m_LoadList As New List(Of CLoad)
Public Property LoadList() As List(Of CLoad)
Get
Return m_LoadList
End Get
Set(ByVal value As List(Of CLoad))
m_LoadList = value
End Set
End Property
Public Sub New()
End Sub
End Class
節:
Public Class CProject
'Variable to hold a list of Load Objects
Private m_LoadList As List(Of CLoad)
Public Property LoadList() As List(Of CLoad)
Get
Return m_LoadList
End Get
Set(ByVal value As List(Of CLoad))
m_LoadList = value
End Set
End Property
Public Sub New()
m_LoadList = New List(Of CLoad)
End Sub
End Class