What should I do about “Possible compare of value type with 'null'”?

前端 未结 4 1263
自闭症患者
自闭症患者 2021-02-04 23:06

While writing this method for a custom NUnit Constraint.

    private void AddMatchFailure(string failureName, TExpected expected, TActu         


        
4条回答
  •  旧时难觅i
    2021-02-04 23:48

    I'm using something like this to check for null on generic types:

    if (Equals(result, Default(T)))
    

提交回复
热议问题