【发布时间】:2012-01-06 12:31:44
【问题描述】:
在 .net 4.0 字典中,我知道我可以像这样计算所有整数值字段的总和:
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
是否存在更优雅的方法来计算总和?
【问题讨论】:
标签: .net vb.net dictionary