我正在使用类似下面的代码。通过循环 DB 结果并从每一行创建一个视图模型BasketItemViewModel
,在类的范围内创建一个数组。Basket
当我放弃Basket
课程并将其设置为空时,我是否需要遍历数组BasketItemViewModel
并将其中的每一个都设置为空?
Class Basket
public GuidId
public BasketItemViewModels
public TotalItems
public TotalCost
Public Property Get TotalCostFormatted()
TotalCostFormatted = FormatCurrency(TotalCost,0)
End Property
public Default function Init(p_GuidId, p_TotalItems, p_TotalCost)
GuidId = p_GuidId
BasketItemViewModels = GetBasketItemViewModels()
TotalItems = p_TotalItems
TotalCost = p_TotalCost
set Init = Me
end function
public function GetBasketItemViewModels()
dim vmArray()
for each row in dbResults
// ...get some values...
set vmArray(i) = (new BasketItemViewModel) (price, quantity, productId)
next
GetBasketItemViewModels = vmArray
end function
End Class