   
-1 |
|
Public Class Invoice
Inherits List(Of Article)
Dim _Pricing As New Dictionary(Of Article, Integer)
Public Function ArticleCount() As Integer
Return Me.Count
End Function
Public Function GetTotal() As Decimal
Dim total As Decimal = 0
For Each art As KeyValuePair(Of Article, Integer) In Me._Pricing
total += art.Key.Price * art.Value
Next
Return total
End Function
Public Overloads Sub Add(ByVal art As Article, ByVal number As Integer)
Me.Add(art)
Me._Pricing.Add(art, number)
End Sub
End Class
Public Class Invoice Inherits List(Of Article) Dim _Pricing As New Dictionary(Of Article, Integer) Public Function ArticleCount() As Integer Return Me.Count End Function Public Function GetTotal() As Decimal Dim total As Decimal = 0 For Each art As KeyValuePair(Of Article, Integer) In Me._Pricing total += art.Key.Price * art.Value Next Return total End Function Public Overloads Sub Add(ByVal art As Article, ByVal number As Integer) Me.Add(art) Me._Pricing.Add(art, number) End Sub End Class
|