zl程序教程

您现在的位置是:首页 >  其他

当前栏目

[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年的一个老兵。