我的数组中有 appsettings.json"steps": [{ "name": "IMPORT", "enabled": true},{ "name": "IMPORT_XML", "enabled": true},{ "name": "COMPARE", "enabled": true},{ "test_name": "COMPARE_TABLE", "enabled": true}]在我的课堂上,我试图用 IConfigurationRoot _configurationRoot我试过了:var procSteps = _configurationRoot.GetSection("steps");foreach (IConfigurationSection section in procSteps.GetChildren()){ var key = section.GetValue<string>("test"); var value = section.GetValue<string>("enabled");}和:var procSteps = _configurationRoot.GetSection("ExecutionSteps") .GetChildren() .Select(x => x.Value) .ToArray();但他们都没有找回我的价值观。有谁知道这是什么情况以及访问此类数组值的正确方法是什么?
1 回答
- 1 回答
- 0 关注
- 680 浏览
添加回答
举报
0/150
提交
取消