如何从下面的app.config文件中读取文化等值。
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="LibrarySetting" type="LibraryConfigUtilities.ConfigurationSectionHandler, LibraryConfigUtilities" />
</configSections>
<LibrarySetting>
<Country Culture="tr-TR" Currency="TRY" DailyPenaltyFee="5,25" PenaltyAppliesAfter="3">
<WeekendSetting>
<Weekend Day="6"/>
<Weekend Day="0"/>
</WeekendSetting>
<HolidaySetting>
<Holiday Date="25.11.2009"/>
<Holiday Date="26.11.2009"/>
<Holiday Date="27.11.2009"/>
</HolidaySetting>
</Country>
<Country Culture="ar-AE" Currency="AED" DailyPenaltyFee="8.00" PenaltyAppliesAfter="4">
<WeekendSetting>
<Weekend Day="5"/>
<Weekend Day="6"/>
</WeekendSetting>
<HolidaySetting>
<Holiday Date="25.11.2009"/>
<Holiday Date="26.11.2009"/>
<Holiday Date="27.11.2009"/>
</HolidaySetting>
</Country>
</LibrarySetting>
</configuration>
我的程序中有以下代码。我想从上面的app.config中读取值。
private List<Country> settingList = new LibrarySetting().LibrarySettingList;
我加了
using LibraryConfigUtilities;
答案 0 :(得分:0)
使用ConfigurationManager.GetSection("LibrarySetting");
看看这是否有助于您到达目的地。
使用此链接作为参考,有一些很好的帮助。 App Config Group Help