编写健壮代码的最佳方式是什么,以便可以检查变量是否为空。
例如:
string a;
if((a != null) && (a.Length() > 0))
{
//do some thing with a
}发布于 2010-05-25 17:00:22
从2.0版开始,您可以使用IsNullOrEmpty。
string a;
...
if (string.IsNullOrEmpty(a)) ...https://stackoverflow.com/questions/2903241
复制相似问题