in asp.net mvc , if i shove a dictionary or an array of objects in ViewData and read that in my view compared to creating a view model class that has that same data structure, is there a performance difference or other consideration or should i expect the same response time?
Share
The response time would be minimal and wouldn’t really make a significant impact on the performance.
It even decreases your performance and is very
hackybecause you’ll have to make extensive use of boxing and unboxing which will fail eventually.Yet the View Model is the
appropriateway to provide model data to the view because it gives you so many more possibilities to work with:It provides:
Html.EnableClientSideValidation())And on top of that. The entire framework is built on top of these little gadget which support you on your journey.
Now go and break some code! :-]