如何判断字符串是否为空串?[6]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 allenlooplee 的 blog

        {
            
return this.internallength();
        }

    }


    
// code here
}

  • rotor里面string类的代码与此没什么不同,只是没有equalshelper方法,代之以如下的声明:

public extern bool equals(string value);

  • 进一步分析:
    • 首先是empty法,由于string.empty是一个静态只读域,只会被创建一次(在静态构造函数中)。但当我们使用empty法进行判空时,.net还会依次展开调用以下的方法,而后两个方法内部还会进行对象引用判等!

public static bool operator ==(string a, string b);

本文关键:如何判断字符串是否为空串?
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top