对象ViewBag的属性的获取器和设置器 [英] Getters and setters for the properties of the object ViewBag
本文介绍了对象ViewBag的属性的获取器和设置器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在哪里可以为对象ViewBag的属性注册getter和setter?
Where can I register getters and setters for the properties of the object ViewBag?
推荐答案
ViewBag是 DynamicObject ,这实际上意味着属性和值是在运行时确定的.最简单的解释是Dictionary<string, object>
.
ViewBag is a DynamicObject which essentially means that the properties and values are determined at runtime. The simplest explanation is that of a Dictionary<string, object>
.
ViewBag.Name = "Title";
和ViewDictionary["Name"] = "Title";
本质上是相同的.因此,没有针对ViewBag的专门的getter和setter方法.动态对象.
ViewBag.Name = "Title";
and ViewDictionary["Name"] = "Title";
are essentially the same. As such there are no getters and setters for the ViewBag specifically. DynamicObjects.
您要完成什么?
这篇关于对象ViewBag的属性的获取器和设置器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文