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