Getting DataBinder Item max value

I am working on a page aspx, and the following code is inserted into the control Repeater:

<%# ((System.Collections.Generic.List<double>)DataBinder.Eval(Container.DataItem, "BookPrices")).Max() %>

It raises the following error: 'System.Collections.Generic.List<double>' does not contain a definition for 'Max'

The list has a method Max(), so I may have messed up my code somehow. What is my problem? BookPrices- the object list<double>that I would like to print with the maximum value.

PS You guys are great! I did not find answers to many of my questions on the Internet. You are truly life savers. Many thanks!:)

+3
source share
1 answer

Do you remember to import System.Linq?

List<T> Max. Max Enumerable.Max. Linq , .

+2

Source: https://habr.com/ru/post/1739181/


All Articles