c# - How do I reflect over the members of dynamic object? -


i need dictionary of properties , values object declared dynamic keyword in .net 4? seems using reflection not work.

example:

dynamic s = new expandoobject(); s.path = "/home"; s.name = "home";  // how enumerate path , name properties , values? idictionary<string, object> propertyvalues = ??? 

if idynamicmetaobjectprovider can provide dynamic member names, can them. see getmembernames implementation in apache licensed pcl library dynamitey (which can found in nuget), works expandoobjects , dynamicobjects implement getdynamicmembernames , other idynamicmetaobjectprovider provides meta object implementation of getdynamicmembernames without custom testing beyond is idynamicmetaobjectprovider.

after getting member names it's little more work value right way, impromptu it's harder point interesting bits , have make sense. here's documentation , equal or faster reflection, however, unlikely faster dictionary lookup expando, works object, expando, dynamic or original - name it.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -