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

后端 未结 8 1945
不知归路
不知归路 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:49

    This can sometimes happen when you have multiple threads working with the same data. If this is the case, you can use a lock to prevent them from messing with eachother.

提交回复
热议问题