Files
codeql/csharp/ql/test/query-tests/API Abuse/InconsistentEqualsGetHashCode/InconsistentEqualsGetHashCode.cs
Owen Mansel-Chan 11e99a03d5 C#
2026-06-10 22:57:22 +02:00

41 lines
594 B
C#

using System;
class ClassMissingGetHashCode // $ Alert
{
public override bool Equals(object other)
{
return false;
}
public new int GetHashCode()
{ // not overridden
return 42;
}
}
class ClassMissingEquals // $ Alert
{
public new bool Equals(object other)
{ // not overridden
return false;
}
public override int GetHashCode()
{
return 42;
}
}
class Class
{
public override bool Equals(object other)
{
return false;
}
public override int GetHashCode()
{
return 42;
}
}