In .net 4.0 dictionary I know I can calculate the sum of all integer value field like this:
Dim dbar As Dictionary(Of String, Integer) = New Dictionary(Of String, Integer)() From {{"A", 1}, {"B", 1}, {"C", 1}}
Dim sum As Integer = 0
For Each v As Integer In dbar.Values
sum += v
Next
Does exist a more elegant way to do calculate the sum?
Just use the
Sum()method: