The type arguments cannot be inferred from the usage. Try specifying the type arguments explicitly

后端 未结 8 1847
灰色年华
灰色年华 2020-12-14 06:21

Could someone please clarify something for me. In my ASP.NET MVC 2 app, I\'ve got a BaseViewModel class which includes the following method:

pu         


        
8条回答
  •  失恋的感觉
    2020-12-14 06:30

    I was actually searching for a similar error and Google sent me here to this question. The error was:

    The type arguments for method 'IModelExpressionProvider.CreateModelExpression(ViewDataDictionary, Expression>)' cannot be inferred from the usage

    I spent maybe 15 minutes trying to figure it out. It was happening inside a Razor .cshtml view file. I had to comment portions of the view code to get to where it was barking since the compiler didn't help much.

    Can you spot it? Yeah... I re-checked it maybe twice and didn't get it at first!

    See that the ViewModel's property is just Zip when it should be Organization.Zip. That was it.

    So re-check your view source code... :-)

提交回复
热议问题