I am kind of new to Generics, and I cannot understand why the following does not work.
I have an extension to IEnumerable<T> called Grid, and it looks like this
public static class IEnumberableGridExtension { public static HelperResult Grid<T>(this IEnumerable<T> gridItems, Action<GridView<T>> thegrid) { ........ } }
Let's say I have a variable in my razor model called Products, and this is a List<Product> , so I tried to do
@Model.Products.Grid<Product>(grid=>{ ... });
It says: βIt is not possible to convert a group of Grid methods into an object without a delegate. Did you intend to call the method?β, With an underlined red underline β@ Model.tasks.Gridβ.
The funny thing is that the visual studio is compiling, everything is in order. Of course, if I just do
@Model.Products.Grid(grid=>{ ... });
Things are good.
source share