Code Inspection: Possible comparison of value type with 'null'
Consider the following piece of code:
While it may not be obvious at first, the
T type can, in fact, be a value type (for example, a
struct or an integer). This would lead to the comparison being ignored altogether, which might not be what the user has intended.
JetBrains Rider does not suggest any quick-fixes here because there is no simple way to check all possible value types of the
One option for resolving this would be to constrain the
T parameter to class types:
However, after such fix you'll have to make sure that all usages of
PrintItems<T>() satisfy the generic constraint.