您的位置:首页 > 移动开发

得到AppSettings中的配置Bool信息

2015-12-18 14:47 483 查看
得到AppSettings中的配置Bool信息

得到AppSettings中的配置Bool信息

/// <summary>
/// 得到AppSettings中的配置Bool信息
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static bool GetConfigBool(string key)
{
bool result = false;
string cfgVal = GetConfigString(key);
if(null != cfgVal && string.Empty != cfgVal)
{
try
{
result = bool.Parse(cfgVal);
}
catch(FormatException)
{
// Ignore format exceptions.
}
}
return result;
}


用法:

bool istrue=GetConfigBool("canupload")
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: