2012-08-01 56 views
1

如何從下面的app.config文件中讀取文化等值。如何從app.config中讀取 - LibraryConfigUtilities

<?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

怎麼樣使用ConfigurationManager.GetSection("LibrarySetting");

看看,這將幫助你在任何地方。

使用此鏈接作爲參考,有一些很好的幫助。 App Config Group Help