1.

What Is The Difference Between Viewbag And Viewdata In Mvc?

Answer»

ViewBag is a wrapper around ViewData, which allows to create dynamic properties.

ADVANTAGE of viewbag over viewdata will be:

  • In ViewBag no need to typecast the objects as in ViewData.
  • ViewBag will take advantage of dynamic KEYWORD which is introduced

in VERSION 4.0. But before USING ViewBag we have to keep in MIND that ViewBag is slower than ViewData.

ViewBag is a wrapper around ViewData, which allows to create dynamic properties.

Advantage of viewbag over viewdata will be:

in version 4.0. But before using ViewBag we have to keep in mind that ViewBag is slower than ViewData.



Discussion

No Comment Found