I wanted to write a method that would take an anonymous object and have it spit out key,value pairs from the properties defined on that anonymous object.
For example:
new {j="j1",k="k1"}
Should create a dictionary with 2 keys (j,k) which have corresponding values of (j1,k1).
A while back I had written about an helper method that would convert all the properties on an object into a dictionary: http://blog.aggregatedintelligence.com/2013/01/convert-objects-property-values-to.html
It turns out that the same method can be used even for anonymous types!
No comments:
Post a Comment
Remember, if you want me to respond to your comment, then you need to use a Google/OpenID account to leave the comment.