sql - Whats Difference in performance of ViewBag and View Data and when to use which one -


i new mvc. want know when should use viewdata, viewbag , tempdata pass objects , there difference in performance of viewdata , viewbag?

view data: view data dictionary object derived view data dictionary class. view data property of controller base class. view data used pass data controller corresponding view. usage:

public actionresult index()

{      viewdata.name = "tony boss";     return view();  } 

view bag view bag dynamic property takes advantage of new dynamic features in c# 4.0. wrapper around view data , used pass data controller corresponding view. view bag property of controller base class.

usage:

public actionresult index()

{      viewbag.name = "tony boss";     return view();  } 

temp data: temp data dictionary object derived temp data dictionary class , stored in short lives session temp data property of controller base class. temp data used pass data current request subsequent request (means redirecting 1 page another).


Comments

Popular posts from this blog

c++ - OpenMP unpredictable overhead -

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

javascript - Wordpress slider, not displayed 100% width -