【发布时间】:2015-06-16 14:53:57
【问题描述】:
我为使用集合的 SSRS 编写了一些自定义代码,并且我在这些集合上使用了 linq 扩展方法 Min。我收到错误消息“Min 不是 System.Collections.Genericlist(of T) 的成员”
我尝试在报告属性窗口中添加以下引用,但没有成功。
System.Linq,版本=4.0.0.0,文化=中性,PublicKeyToken=b03f5f7f11d50a3a
代码如下:
Public Function GetMinValue(ByVal a As String, ByVal b As String, ByVal c As String, ByVal d As String)
Dim first As Decimal = System.Convert.ToDecimal(a)
Dim second As Decimal = System.Convert.ToDecimal(b)
Dim third As Decimal = System.Convert.ToDecimal(c)
Dim fourth As Decimal = System.Convert.ToDecimal(d)
Dim itemsList As New System.Collections.Generic.List(Of Decimal)()
If first <> 0 Then itemsList.Add(first)
If second <> 0 Then itemsList.Add(second)
If third <> 0 Then itemsList.Add(third)
If fourth <> 0 Then itemsList.Add(fourth)
Dim smallest As Decimal
Dim count As Integer = itemsList.Count
If count = 0 Then smallest = Nothing
If count > 0 Then smallest = itemsList.Min()
Return smallest
End Function
我错过了什么?
【问题讨论】: