Generate Equals and GetHashCode methods for reference types, similar to what Resharper does https://www.jetbrains.com/resharper/documentation/help20/AdvEditing/generateEquals.html and following the guidelines in http://msdn.microsoft.com/en-us/library/ms173147(v=vs.80).aspx
Only reference types. For value types see #60.
This:
class MyClass
{
public int Prop1 { get; private set; }
public float Prop2 { get; private set; }
}
Becomes:
class MyClass
{
public int Prop1 { get; private set; }
public float Prop2 { get; private set; }
public bool Equals(MyClass other)
{
if(other == null) {return false; }
return other.Prop1 == Prop1 && other.Prop2 == Prop2;
}
public bool Equals(Object other) {
if(other == null) { return false; }
var obj = other as MyClass;
if(obj == null) { return false; }
return Equals(obj);
}
public override int GetHashCode()
{
unchecked
{
int hash = (int) 2166136261;
hash = hash * 16777619 ^ Prop1.GetHashCode();
hash = hash * 16777619 ^ Prop2.GetHashCode();
return hash;
}
}
}
This is essentially a refactoring, so we are classifying it as a Hidden diagnostic.
Diagnostic id: CC0059
Category: Refactoring
See references on the comments below.
Generate
EqualsandGetHashCodemethods for reference types, similar to what Resharper does https://www.jetbrains.com/resharper/documentation/help20/AdvEditing/generateEquals.html and following the guidelines in http://msdn.microsoft.com/en-us/library/ms173147(v=vs.80).aspxOnly reference types. For value types see #60.
This:
Becomes:
This is essentially a refactoring, so we are classifying it as a
Hiddendiagnostic.Diagnostic id:
CC0059Category:
RefactoringSee references on the comments below.