mirror of
https://github.com/github/codeql.git
synced 2025-12-19 18:33:16 +01:00
36 lines
737 B
C#
36 lines
737 B
C#
public class Test1
|
|
{
|
|
public override bool Equals(object other)
|
|
{
|
|
var otherTest = other as Test1; // BAD
|
|
return otherTest != null;
|
|
}
|
|
}
|
|
|
|
public sealed class Test2
|
|
{
|
|
public override bool Equals(object other)
|
|
{
|
|
var otherTest = other as Test2; // GOOD
|
|
return otherTest != null;
|
|
}
|
|
}
|
|
|
|
public class Test3
|
|
{
|
|
public override bool Equals(object other)
|
|
{
|
|
var otherTest = other as Test3; // GOOD
|
|
return otherTest != null && other.GetType() == typeof(Test3);
|
|
}
|
|
}
|
|
|
|
public class Test4
|
|
{
|
|
public override bool Equals(object other)
|
|
{
|
|
var otherTest = other as Test4; // GOOD
|
|
return otherTest != null && otherTest.GetType() == typeof(Test4);
|
|
}
|
|
}
|