Can't operator == be applied to generic types in C#?

前端 未结 12 653
囚心锁ツ
囚心锁ツ 2020-11-22 02:21

According to the documentation of the == operator in MSDN,

For predefined value types, the equality operator (==) returns true if th

12条回答
  •  温柔的废话
    2020-11-22 02:44

    There is an MSDN Connect entry for this here

    Alex Turner's reply starts with:

    Unfortunately, this behavior is by design and there is not an easy solution to enable use of == with type parameters that may contain value types.

提交回复
热议问题