c# - how to get dynamic value using string instead of key? -


i have web api controller looking similar this:

public void post([frombody]dynamic postdata) {     foreach (var row in postdata)     {        var email = row.email.value; // ok        var eventtype = row.event.value; // cannot use because "event" reserved .net, c# or whatever     } }    

i'm getting json external system contains "event" property (outside of control), i'm unable retrieve. i've tried dozens of workaround, none of them seemed work in scenario. there easy way of retrieving it.

the best bet had using reflection like:

row.gettype().getproperty("event").getvalue(row, null); 

but didn't work had expected. there else can try?

solution use "@" like:

row.@event.value 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -