How to add properties in an ExpandoObject ()? [duplicate]

-1

I was using dynamic type and was warned that it has a performance problem.

How could I make the code below using ExpandoObject ?

 dynamic dObject = new ExpandoObject();
 dObject.a= a;

And how could I sort a list of ExpandoObject ?

With a list of dynamic I can do this:

dList.OrderBy(minhalista => minhalista.a).ToArray();

But with Expand I can not.

    
asked by anonymous 17.08.2017 / 17:28

1 answer

1

ExpandoObject is of "type" dynamic .

So you should use it that way.

dynamic dObject = new ExpandoObject();
dObject.A = new ExpandoObject();
dObject.A.Nome = "Paulo";
    
17.08.2017 / 17:31