[Config]如何利用ConfigurationSettings.AppSettings.GetValues读取配置文件中多个同Key的value
配置文件 如何 利用 读取 多个 Key value config
2023-09-14 08:58:21 时间
默认情况下,
string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri");
是无法读取配置文件中多个同Key的value的。如下所示的配置:
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们, 只有这么做才可以: 单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中; 编译MultipleSectionHandler,生成MultipleSectionHandler.dll; 将WebApp应用的Web.config文件中加入 configSections
remove name="appSettings" /
section name="appSettings" type="MyCompany.Configuration.NameValueMultipleSectionHandler, MultipleSectionHandler" /
/configSections 表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。 这时候就可以针对Web.config中的: appSettings
add key="Uri" value="uri1"/
add key="Uri" value="uri2"/
add key="Uri" value="uri3"/ /appSettings string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri"); 来读取了。
Android逆向:resource.arsc文件解析(Config List) resource.arsc是APK打包过程中生成一个重要的文件,主要存储了整个应用哦中的资源索引。但是这个文件是一个二进制文件,并不可读,所以本文就通过解析它的二进制内容来读懂这个文件。
This is the default behaviour for any application which has the Spring Cloud Config Client on the classpath.
郑昀 ☑移动数据业务 times;6年 ☑语义聚合 times;4年 ☑O2O times;5年的一个老兵。
http://www.codeproject.com/dotnet/namevaluemultiple.asp告诉我们, 只有这么做才可以: 单独建立一个类库MultipleSectionHandler,把NameValueMultipleSectionHandler.cs加进去,并将MultipleSectionHandler.csproj加入到我们的工程中; 编译MultipleSectionHandler,生成MultipleSectionHandler.dll; 将WebApp应用的Web.config文件中加入 configSections
remove name="appSettings" /
section name="appSettings" type="MyCompany.Configuration.NameValueMultipleSectionHandler, MultipleSectionHandler" /
/configSections 表明对于appSettings的读取将采用我们自己的MultipleSectionHandler处理。 这时候就可以针对Web.config中的: appSettings
add key="Uri" value="uri1"/
add key="Uri" value="uri2"/
add key="Uri" value="uri3"/ /appSettings string[] strArray = System.Configuration.ConfigurationSettings.AppSettings.GetValues("Uri"); 来读取了。
Android逆向:resource.arsc文件解析(Config List) resource.arsc是APK打包过程中生成一个重要的文件,主要存储了整个应用哦中的资源索引。但是这个文件是一个二进制文件,并不可读,所以本文就通过解析它的二进制内容来读懂这个文件。
This is the default behaviour for any application which has the Spring Cloud Config Client on the classpath.
郑昀 ☑移动数据业务 times;6年 ☑语义聚合 times;4年 ☑O2O times;5年的一个老兵。
相关文章
- 利用ini_set()函数实现对php配置文件的修改
- Redis配置文件详解
- Redis 3.0 与 3.2 配置文件变化
- Spring配置文件总结
- Linux下如何查看定位当前正在运行的Nginx的配置文件
- EasyPlayerPro windows播放器本地配置文件配置方法介绍
- bash 的配置文件加载顺序
- .NET平台开源项目速览(1)SharpConfig配置文件读写组件
- yml语法学习 SpringBoot配置文件自动装配 yml文件有提示读取配置文件
- 如何修改geditor的配置文件 -好像geditor没有文本格式的配置文件? 要使用dconf-editor来配置- geditor自己配置编码格式
- Nginx 服务器安装及配置文件详解
- springboot系列-springboot配置文件读取