level 1
判断字符串不为空的时候我用
if (user.DeptID.Length != 0)
{
.......
}
报错
用
if (user.DeptID != "")
{
..................
}
当user.DeptID为空的时候也进去走里面的代码了,
用
if (!user.DeptID.Equals(""))
{
.....................
}
也是报错是怎么回事啊?
有没有同学知道我要判断字符串不为空的代码怎么写啊?
2015年07月26日 09点07分
1
level 8
if(!isNullOrEmpty(user.DeptID)){}
2015年08月12日 06点08分
4
首先你得确定user.DeptID是不是一个字符串,如果压根都取不到值,怎么去判断是不是空么
2015年08月12日 06点08分