Reputation: 7636
I've the following.
<td>@((IEnumerable<IAccountProductItem>)Model.Data).Sum(i => i.Live)</td>
At the moment its output System.Linq.Enumerable+d__3a`1 ......... to the page and I want it to be evaluated and output as the sum i.e 44
Any ideas? Sure this is simple.
Thanks
Upvotes: 0
Views: 1328
Reputation: 1500065
I'm not an MVC person, but it sounds like you're mostly missing brackets. Try:
<td>@(((IEnumerable<IAccountProductItem>)Model.Data).Sum(i => i.Live))</td>
Hopefully this will convince the Razor engine that the whole expression is what you want evaluated, not just the bit before .Sum
.
Upvotes: 3