Getters and setters for the properties of the object ViewBag

后端 未结 1 1095
孤独总比滥情好
孤独总比滥情好 2021-01-25 01:39

Where can I register getters and setters for the properties of the object ViewBag?

相关标签:
1条回答
  • 2021-01-25 02:18

    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"; and ViewDictionary["Name"] = "Title"; are essentially the same. As such there are no getters and setters for the ViewBag specifically. DynamicObjects.

    What is it you're trying to accomplish?

    0 讨论(0)
提交回复
热议问题