C# object is not null but (myObject != null) still return false

后端 未结 8 1939
不知归路
不知归路 2020-12-05 10:57

I need to do a comparaison between an object and NULL. When the object is not NULL I fill it with some data.

Here is the code :

 if (region != null)
         


        
8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-05 11:41

    bool comp;
    if (object.IsNullOrEmpty(r1))
    {
        comp = false;
    }
    
    if (object.IsNullOrEmpty(r2))
    {
        comp = false;
    }
    return comp;
    

提交回复
热议问题