I'm working at the aspx
page, and the following code is inserted in a Repeater
control:
我在aspx页面工作,下面的代码被插入到中继器控件中:
<%# ((System.Collections.Generic.List<double>)DataBinder.Eval(Container.DataItem, "BookPrices")).Max() %>
Brings up the following error: 'System.Collections.Generic.List<double>' does not contain a definition for 'Max'
出现以下错误:“system . collection . generic . generic”。列表
List does have an method of Max()
, so I'm possibly messing up my code somehow. What is my problem? BookPrices
is a list<double>
object, which I'd like to print it's maximum value.
List确实有Max()的方法,所以我可能把代码搞砸了。我的问题是什么?BookPrices是一个
P.S. You guys are great! I didn't find answers for many of my questions on the web. You really are life savers. Thank you very much! :)
附注:你们太棒了!我在网上找不到很多问题的答案。你真的是救生员。非常感谢!:)
1 个解决方案
#1
2
Did you make sure to import System.Linq
?
你确定要导入System.Linq吗?
List<T>
does not actually have a Max
method. Instead Max
most often binds to the extension method Enumerable.Max
. Linq needs to be imported in order for this to work.
List
#1
2
Did you make sure to import System.Linq
?
你确定要导入System.Linq吗?
List<T>
does not actually have a Max
method. Instead Max
most often binds to the extension method Enumerable.Max
. Linq needs to be imported in order for this to work.
List