Is ViewData the new standard over ViewBag for ASP.Net 5 (core)?

Both are still valid. There is no specific guidance on the docs.asp.net github project. Although there is this discussion on docs.asp.net issues.

That links through to a comment from one the product team which says:

“Since ViewData (Dictionary) look-ups far out-perform ViewBag
(dynamic) invocations, the last is probably the best choice.”

So I’d say it purely a style choice based upon the fact that ViewData performs better.

Leave a Comment