如何读写 app.config

using System;
如何读写 app.config
using System.Collections.Generic;
如何读写 app.config
using System.Text;
如何读写 app.config
using System.Configuration;
如何读写 app.config
using System.Collections;
如何读写 app.config
如何读写 app.config
namespace ServicesConfiguration
如何读写 app.config
{
如何读写 app.config    
public class ConfigurationDispose
如何读写 app.config    
{
如何读写 app.config        
public ConfigurationDispose()
如何读写 app.config        
{
如何读写 app.config         }

如何读写 app.config
如何读写 app.config        
#region GetConfiguration
如何读写 app.config        
/// <summary>
如何读写 app.config        
/// 取得appSettings里的值
如何读写 app.config        
/// </summary>
如何读写 app.config        
/// <param name="key"></param>
如何读写 app.config        
/// <returns></returns>

如何读写 app.config        public static string GetConfiguration(string key)
如何读写 app.config        
{
如何读写 app.config            
return ConfigurationManager.AppSettings[key];
如何读写 app.config         }

如何读写 app.config        
#endregion

如何读写 app.config
如何读写 app.config        
#region GetConfigurationList
如何读写 app.config        
/// <summary>
如何读写 app.config        
/// 取得appSettings里的值列表
如何读写 app.config        
/// </summary>
如何读写 app.config        
/// <param name="filePath">配置文件路径</param>
如何读写 app.config        
/// <returns>值列表</returns>

如何读写 app.config        public static KeyValueConfigurationCollection GetConfigurationList(string filePath)
如何读写 app.config        
{
如何读写 app.config             AppSettingsSection appSection
= null;                       //AppSection对象
如何读写 app.config
             Configuration configuration = null;                         //Configuration对象     
如何读写 app.config
             KeyValueConfigurationCollection k = null;                   //返回的键值对类型
如何读写 app.config

如何读写 app.config             configuration
= ConfigurationManager.OpenExeConfiguration(filePath);
如何读写 app.config
如何读写 app.config            
//取得AppSettings节
如何读写 app.config
             appSection = (AppSettingsSection)configuration.Sections["appSettings"];
如何读写 app.config
如何读写 app.config            
//取得AppSetting节的键值对
如何读写 app.config
             k = appSection.Settings;
如何读写 app.config
如何读写 app.config            
return k;
如何读写 app.config                    
如何读写 app.config         }

如何读写 app.config        
#endregion

如何读写 app.config
如何读写 app.config     

相关文章: