string.IsNullOrEmpty方法

public static bool IsNullOrEmpty(string value)
{
    if (value != null)
    {
        return (value.Length == 0);
    }
    return true;
}
 
不要再傻着写下:

if (string.IsNullOrEmpty(s) || s.Length == 0)

这样的C#代码了,会被耻笑的!

哎! 还是多熟悉.NET Framework吧

posted on 2010-03-23 15:59  kevin@  阅读(220)  评论(1编辑  收藏  举报