Reputation: 30103
In razor view engine, you can add property (I'm not sure if they are called properties) to the Page
object. How can I create an object that behaves like Page
? Here's the sample code in Razor C#:
Page.AProperty = "Hi";
Page.AnotherProperty = 1;
Upvotes: 0
Views: 428
Reputation: 75306
You can use ExpandoObject
:
dynamic obj = new ExpandoObject();
obj.Pro1 = 1;
obj.Pro2 = "Hi";
Upvotes: 6