读书人

没可访问的“Sum”接受此数目的类型实

发布时间: 2013-03-01 18:33:02 作者: rapoo

没有可访问的“Sum”接受此数目的类型实参


Private m_skus As System.Collections.Generic.Dictionary(Of String, SKUItem)
Public ReadOnly Property Stock() As Integer
Get
Return Me.m_skus.Values.Sum(Of SKUItem)(Function(sku As SKUItem) sku.Stock)
End Get
End Property

提示错误:

没有可访问的“Sum”接受此数目的类型实参,因此重载决策失败。
Dictionary
[解决办法]
  Private m_skus As System.Collections.Generic.Dictionary(Of String, SKUItem)
Public ReadOnly Property Stock() As Integer
Get
Return Me.m_skus.Values.Sum((Function(sku As SKUItem) sku.Stock))
End Get
End Property

读书人网 >VB Dotnet

热点推荐