ViewData
|
ViewBag
|
TempData
|
It is Key-Value Dictionary collection
|
It is a type object
|
It is Key-Value Dictionary collection
|
ViewData is a dictionary object and it is property of ControllerBase class
|
ViewBag is Dynamic property of ControllerBase class.
|
TempData is a dictionary object and it is property of controllerBase class.
|
ViewData is Faster than ViewBag
|
ViewBag is slower than ViewData
|
NA
|
ViewData is introduced in MVC 1.0 and available in MVC 1.0 and above
|
ViewBag is introduced in MVC 3.0 and available in MVC 3.0 and above
|
TempData is also introduced in MVC1.0 and available in MVC 1.0 and above.
|
ViewData is also work with .net framework 3.5 and above
|
ViewBag is only work with .net framework 4.0 and above
|
TempData is also work with .net framework 3.5 and above
|
Type Conversion code is required while enumerating
|
In depth, ViewBag is used dynamic, so there is no need to type conversion while enumerating.
|
Type Conversion code is required while enumerating
|
It value become null if redirection is occurred.
|
Same as ViewData
|
TempData is used to pass data between two consecutive requests.
|
It lies only during the current request.
|
Same as ViewData
|
TempData is only work during the current and subsequent request
|
Here I am posting the important questions whatever I have faced in my interviews. (Few of the contents & links have been taken from various blogs/articles.) Hope it will help you..
Friday, 9 May 2014
ViewData VS ViewBag VS TempData ?
Subscribe to:
Post Comments (Atom)
How to improve applications performance which is hosted in cloud ?
Improving the performance of an application hosted in Microsoft Azure involves a combination of optimizing your application code, leveraging...
-
Connection pool is the collection of new, open and all type of database connections. Opening database connection is a time consuming op...
-
Before start the programming you need to know exactly what is the Fibonacci series, why it comes around the world?? Golden mean: ...
No comments:
Post a Comment