I'm some what new to Generics and I can't figure out why the following doesn't work.
I have an extension to IEnumerable<T>
, called Grid and it looks like so
public static class IEnumberableGridExtension
{
public static HelperResult Grid<T>(this IEnumerable<T> gridItems, Action<GridView<T>> thegrid)
{
........
}
}
Say, I have a variable in my razor Model called "Products" and it is the type List<Product>
, so I tried to do
@Model.Products.Grid<Product>(grid=>{
...
});
It states "Cannot convert method group 'Grid" to non-delegate type 'object'. Did you intend to invoke the method?", with "@Model.tasks.Grid" red underlined.
The funny thing is, visual studio compiles, everything is fine. Of course, if i simply do
@Model.Products.Grid(grid=>{
...
});
It's all fine.