Reputation: 15853
It seems that in Views, there is limited libraries available (is it true?), see below:
My question is how do I convert an IEnumerable to, say, an array or a list? I normally can use methods like ToArray()
, ToList()
, or Cast<T>()
in a regular C# file, but they all seem to have disappeared when it comes to Views (in ASP.NET MVC).
Upvotes: 3
Views: 2444
Reputation: 56182
<%@ import namespace='System.Linq' %>
You can also add your namespace in the Web.config
, i.e.:
<system.web>
<pages>
<namespaces>
<add namespace='System.Linq' />
</namespaces>
</pages>
</system.web>
Upvotes: 11