SOTI Interview Question

Difference between ViewBag and ViewData

Interview Answers

Anonymous

Apr 30, 2018

Viewbag uses properties, viewdata is an array. E.g: ViewBag.foo = foo, ViewData["foo"] = foo.

Anonymous

Apr 29, 2019

ViewBag is dynamic and properties are accessed using . operator whereas ViewData is a Dictionary