若str 为空值 isnothing(str) 返回1

解决方案 »

  1.   

    if(str == null)未负值
    if(str == string.Empty)为空
      

  2.   

    isnothing(str) 
    if(str == null)未负值
    if(str == string.Empty)为空
    都是很有效的方法
      

  3.   

    我总是这样用的
    if(str==""||str==null||str==string.empty)
      

  4.   

    if(str == "")
    {  空 }
    else
    {  不空 }
      

  5.   

    if(str.trim()==""||str==null||str==string.empty)
      

  6.   

    if(str==null||str==string.Empty||str.Equals(""))
      

  7.   

    if(str="")
    {}
    else
    {}
     
      

  8.   

    if(str="")
    {}
    else
    {}
      

  9.   

    if (str==string.Empty) {//...}
    等效
    if (str=="") {//...}