ViewBag vs ViewData performance difference in MVC?

后端 未结 2 1909
太阳男子
太阳男子 2021-02-02 07:52

I know that ViewData and ViewBag both use the same backing data and that neither are as good as using strongly typed models in most cases. However when choosing between the two

2条回答
  •  醉梦人生
    2021-02-02 08:29

    I haven't done any test but my gut feel is that in real world scenarios the difference is just negligible. You will probably access it a few times on each page and a few CPU cycles won't make any difference. One can find bigger performance improvements in other places.

提交回复
热议问题