I am really curious to know how the Expando Object in .Net 4.0 has been internally implemented?
You don't have to mess with Reflector, the source code for the DLR is readily available for download here. Nicely commented too. You'll find the source code for ExpandoObject in src\Runtime\Microsoft.Scripting.Core\Actions\ExpandoObject.cs
The data store for an ExpandoObject is an ExpandoData, available in the same source file. The values are stored in a simple object[]. The ExpandoClass (same directory) keeps track of the keys in a simple string[]. ExpandoObject definitely doesn't use a Dictionary as earlier stated, but it does implement IDictionary.
It's implemented as a dictionary internally.
Check out Alexandra Rusina's blog on the topic here, and mine here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With