How to compare nullable types?

后端 未结 8 1551
夕颜
夕颜 2021-01-31 13:32

I have a few places where I need to compare 2 (nullable) values, to see if they\'re the same.

I think there should be something in the framework to support this, but can

8条回答
  •  臣服心动
    2021-01-31 14:13

    You can use the static Equals method on System.Object:

    var equal = object.Equals(objA, objB);
    

提交回复
热议问题