I am trying to run Razor ViewEngine from ASP.NET MVC 3 Preview 1 and I am having a problem using the Any() extension method.
Here is the code that I use to set the property in the controller:
ViewModel.Comparisons = DB.Comparisons.Where(c => c.UserID == this.UserID).ToArray();
Here is the code in the view where I am trying to use Any() :
@if (!View.Comparisons.Any()) { <tr> <td>You haven't not started any comparisons yet. @Html.Action("Start a new comparison?", "create", "compare")</td> </tr> }
I get an exception that says:
'System.Array' does not contain a definition for 'Any'
I tried to add the System.Linq namespace to the pages\namespaces section in the web.config file and add the @using System.Linq line at the top of the view, none of which changed the situation. What do I need to do to access LINQ extension methods?
Update: It seems that this is due to the fact that it is a property of a dynamic object - it works if I manually dropped it on IList<T> .
source share