通常,我们可以创建这样的属性,
dynamic expando = new ExpandoObject();
expando.Price = 45k;
expando.Value = "Good";
就我而言,直到运行时我才会知道诸如“价格”或“价值”之类的属性。如何,我可以创建这样的动态属性。就像是,
dynamic expando = new ExpandoObject();
expando[properties[0]] = 45k;
expando[properties[1]] = "Good";
expando[properties[2]] = "Red";
expando[properties[3]] = 8;
无论如何要实现这种行为。