What is the difference between (“”) and (null)

前端 未结 9 1218
鱼传尺愫
鱼传尺愫 2021-01-04 18:33

While trying to set Validations i initially encountered some problems with checking if a textbox is null, i tried using

    private void btnGo_Click(object s         


        
9条回答
  •  旧巷少年郎
    2021-01-04 19:23

    In layman's term, null means lacking of value and "" mean zero-length string, which is not the same thing. There might be some piece of software that treat null string and "" equally e.g. Console.WriteLine, but it still does not make them the same thing.

    Strictly speaking, "" == null expression is false by design. The equality comparison of String type in .NET framework works by == operator overloading, which does not treat null as equal to "".

提交回复
热议问题