Consider the following piece of code:
While it may not be obvious at first, the
T type can, in fact, be a value type (e.g., a
struct or an integer). This would lead to the comparison being ignored altogether, which might not be what the user has intended.
One option for resolving this would be to constrain the
T parameter to
The other option would be to change the comparison value from
null to the default value for the particular type: