What is the difference between @Model and @ ViewData.Model?

On my browse page, both seem to work. But for @Model visual studio tells me this WebViewPage<T>.Model , and for @ViewData.Model - ViewDataDictionary<T>.Model . So what is the real difference?

+8
asp.net-mvc asp.net-mvc-3 razor
source share
1 answer

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; } } //... } 
+13
source share

All Articles