Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在剃刀视图引擎中,您可以向对象添加属性(我不确定它们是否称为属性)Page。如何创建行为类似的对象Page?这是 Razor C# 中的示例代码:
Page
Page.AProperty = "Hi"; Page.AnotherProperty = 1;
您可以使用ExpandoObject:
ExpandoObject
dynamic obj = new ExpandoObject(); obj.Pro1 = 1; obj.Pro2 = "Hi";