this might be an easy one but I am really not getting it.
As far as I understand:
The most dynamic
types ins C# rely on IDictionary<string,object>
I did a spike with WebMatrix.Data and I would like to cast my result to IDictionary<string,object>
but this does not work...
WebMatrix.Data query returns an IEnumerable<DynamicRecord>
This is what I try to cast...
here is my naiv code ...
var o = (DynamicObject) webmatrixRecord; // No Exception but o is still DynamicRecord
var o = (IDictionary<string,object>) webmatrixRecord; // Runtime Binder Exception
var o = ((IDictionary<string,object>)((DynamicRecord)webmatrixRecord)) // InvalidCastException;
So what is a proper way to cast an Dynamic object?
WebMatrix.DynamicRecord: http://msdn.microsoft.com/de-de/library/webmatrix.data.dynamicrecord(v=vs.111).aspx
Dynamics.DynamicRecord: http://msdn.microsoft.com/de-de/library/system.dynamic.dynamicobject(v=vs.111).aspx