Reputation: 3006
In my view page, both seem work. But for @Model
, visual studio tells me it's WebViewPage<T>.Model
, and for @ViewData.Model
, it is ViewDataDictionary<T>.Model
. So what's the real difference there?
Upvotes: 10
Views: 2374
Reputation: 139758
No there is no difference. In fact WebViewPage<T>.Model
just calls ViewData.Model
.
You can check the implementation on codeplex:
public abstract class WebViewPage<TModel> : WebViewPage
{
//...
public new TModel Model
{
get { return ViewData.Model; }
}
//...
}
Upvotes: 16