public static bool IsNullOrEmpty(this string str)
{
if (str == string.Empty || str == null)
return true;
else return false;
}
public static bool IsNotNullAndEmpty(this string str)
{
if (str != string.Empty && str != null)
return true;
else return false;
}
{
if (str == string.Empty || str == null)
return true;
else return false;
}
public static bool IsNotNullAndEmpty(this string str)
{
if (str != string.Empty && str != null)
return true;
else return false;
}

本文介绍了一个简洁的C#扩展方法用于检查字符串是否为空或为默认空字符串,提高了代码的可读性和效率。
2000

被折叠的 条评论
为什么被折叠?



