1

I've come across the following code that doesn't work

public void Execute(dynamic options){
   var dictionary = options as IDictionary<string,object>();//i saw the dictionary is always null but the developer is says it suppose to work!
}

where the options holds a json

[{Id :1212, Page : 12, SortColumn : "Name", SortBy : "ASC"}]

My question is does this suppose to work? I mean hei is it possible to cast a json which is referenced by a dynamic type to a IDictionary without any blackmagic?

user2003511
  • 77
  • 1
  • 9
  • 1
    You could use an `object` type as a parameter. Or implement a Dynamic Dictionary. Take a look: http://reyrahadian.wordpress.com/2012/02/01/creating-a-dynamic-dictionary-with-c-4-dynamic/ – Felipe Oriani Jan 23 '13 at 10:38

0 Answers0