""与string.Empty确实不同。
不同的原因就好象sql中的''和null不同一样。
这个道理不会说。哈

解决方案 »

  1.   

    在Managed Code中, Microsoft guidelines推荐开发者在返回值为数组与字符串时,避免使用null,推荐的方法是, 用一个空字符串(empty string)作为字符串返回值,用一个空的数组(empty array)作为数组的返回值。空字符串可以用String.Empty或””,
      

  2.   

    要说string.Empty比""更面向对象,更安全,还是比较有道理;
    要是说string.Empty与""有什么不同,有什么根据吗?
      

  3.   

    String.Empty 字段
    表示空字符串。此字段为只读字段。[Visual Basic]
    Public Shared ReadOnly Empty As String[C#]
    public static readonly string Empty;[C++]
    public: static String* Empty;[JScript]
    public static var Empty : String;备注
    此字段的值为零长度字符串 ""。这是MSDN里面的.你们看备注就知道了,String.Empty=="";
      

  4.   

    if (userName != "" || userName !=string.Empty) 
    那就是说微软的这句代码是垃圾?
      

  5.   

    应该是if (userName != null || userName !=string.Empty)
      

  6.   

    对:
        应该是if (userName != null || userName !=string.Empty)
    谁都有弄错的地方
      

  7.   

    确实是弄错了
    --if (userName != "" || userName !=string.Empty) 
    --那就是说微软的这句代码是垃圾?
      

  8.   

    经过测试
    if(string.Empty=="")
    Response.Write("<script>alert(\"Hello\");</script>");
    总能弹出Hello对话框
      

  9.   

    个人觉得||后面的是废话。
    因为public class System.String
    {
      const string Empty = "";}
      

  10.   

    还有呢?.Equals() 与 == 的区别呢?谁能给俺讲讲?
      

  11.   

    微软作的例子是在告诉我们
        if (userName != "" || userName !=string.Empty)  用这两个哪个都可以!
    1.微软并没有错!
    2.微软告诉我们有两种方法,使用哪个都行,它给我们来了个枚举
      

  12.   

    if (userId != "" && userId != string.Empty)
    天那,这个例子里这样的东西很多呵。They are mad or I am?
      

  13.   

    大家来看看这篇文章,看完了就明白了~~
    http://blog.csdn.net/allenlooplee/archive/2004/11/11/177590.aspx