简体   繁体   中英

Can I use a string in-line with a dynamic?

I have the following code to collect a value from a json object using dynamic.

var valueOne = jsonObj.features[0].properties.POLYGON_NM.ToString();

I would like to grab other values as well, without manually typing every option.

var valueTwo = jsonObj.features[0].properties.[TEXTBOX_VALUE].ToString();

Is this possible using Dynamics?

you can use JObject for this senario.

        JObject j = JObject.Parse("your json");
        var valueTwo = j["TEXTBOX_VALUE"];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM