I have my class properties like this:
//Properties
public int Id { get; set; }
public Transform Trs { get; set; }
public List<AS_Node> childList { get; set; }
And my overrides are like this:
//Overrides
public override bool Equals(object obj) {
return (this.Id == ((AS_Node)obj).Id);
}
public override int GetHashCode() {
return this.Id.GetHashCode();
}
public static bool operator ==(AS_Node one, AS_Node two) {
return one.Equals(two);
}
public static bool operator !=(AS_Node one, AS_Node two) {
return !one.Equals(two);
}
My question is, is this the right way of doing it?
It’s just the matter of style On my work we had different coding rules, and used different styles. Of course, it’s possible to return false without an else statement.