Question: In c# im trying to dynamically access a value in a json object it works if I chance the if statement to look like if(json.dog==

In c# im trying to dynamically access a value in a json object it works if I chance the if statement to look like if(json.dog== "corgi") but I cant get it to dynamically map into the type. Ive tried : if(json + "." + type) but it didnt map correctly.

THE CODE:

dynamic json= json object

string type = dog;

public void fcn2(dynamic json, string type){

if(json.type == "corgi"){

}

If you could help it would be much appreciated!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!