2

如何从下面的 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;
4

1 回答 1

0

怎么用ConfigurationManager.GetSection("LibrarySetting");

看看这是否能帮助你到任何地方。

使用此链接作为参考,有一些很好的帮助。应用配置组帮助

于 2012-08-01T21:00:18.157 回答