mirror of
https://github.com/github/codeql.git
synced 2025-12-18 09:43:15 +01:00
26 lines
402 B
C#
26 lines
402 B
C#
class NullArgumentToEquals
|
|
{
|
|
void M()
|
|
{
|
|
int i = 0;
|
|
i.Equals(null); // BAD
|
|
|
|
int? i2 = null;
|
|
i2.Equals(null); // GOOD
|
|
|
|
C<int> c = null;
|
|
c.Equals(null); // BAD
|
|
|
|
object o = null;
|
|
o.Equals(null); // BAD
|
|
}
|
|
|
|
class C<T>
|
|
{
|
|
public override bool Equals(object other)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|