Add Dump to ExpandoObject
'System.Dynamic.ExpandoObject' does not contain a definition for 'Dump'
Can this be added? (Is it possible?)
12
votes
![](https://secure.gravatar.com/avatar/d41d8cd98f00b204e9800998ecf8427e?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
-
Yes - or you can cast it to object - or use Console.WriteLine instead and get the same result:
dynamic x = new ExpandoObject();
x.Name = "Mario";
x.Age = 23;
((object)x).Dump();
Console.WriteLine (x); // same result -
Hemme commented
You can cast it to IDictionary<string,object> before dumping it.
For instance:dynamic x = new ExpandoObject();
x.Name = "Mario";
x.Age = 23;
((IDictionary<string,object>)x).Dump();