Why does intellisense prefer to "autocomplete" with dynamic version of method instead of strongly typed version?

67 views Asked by At

I am trying to use WebGrid for the first time, but I came upon this article (and thus this NuGet package made by the same guy) which should provide a strongly typed Column method.

So this... :

public WebGridColumn Column(
    string columnName = null, 
    string header = null, 
    Func<T, object> format = null, 
    string style = null, 
    bool canSort = true)

...Should replace this:

public WebGridColumn Column(
    string columnName = null, 
    string header = null, 
    Func<dynamic, object> format = null, 
    string style = null, 
    bool canSort = true)

... As long as I instantiate a WebGrid<T> instead of a WebGrid.

The problem is, whenever I try to use the Column method, Intellisense's code completion still insists on the dynamic version, basically not helping at all and defeating the entire purpose of installing the package. Why is this happening and how can I make use of intellisense without having to manually cast (Func<T, object>)format?

0

There are 0 answers