using System.Configuration; namespace FCS.Common { /// /// 配置管理类 /// public static class ConfigHelper { /// /// 获取指定返回类型的配置项值 /// 如果类型不匹配则返回该返回类型默认值 /// /// 指定返回类型 /// 配置项key /// public static T GetConfigValue(string key) { try { object o = ConfigurationManager.AppSettings[key]; if (o != null) { return CommonHelper.ChangeType(o); } } catch { } return default(T); } } }