CP-36392: Remove base calls directly based on the object reference.

Two objects will never have the same hash since base methods are based on direct object reference

Signed-off-by: Danilo Del Busso <Danilo.Del.Busso@citrix.com>
This commit is contained in:
Danilo Del Busso 2021-09-15 13:54:45 +01:00
parent 825c795ea4
commit 2d1e6dcb92
4 changed files with 10 additions and 14 deletions

View File

@ -478,19 +478,15 @@ namespace XenAdmin.Controls.CustomDataGraph
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
if(!(obj is DataSet)) if (!(obj is DataSet other))
return base.Equals(obj); return false;
DataSet other = (DataSet)obj;
return Id == other.Id; return Id == other.Id;
} }
public override int GetHashCode() public override int GetHashCode()
{ {
if (string.IsNullOrEmpty(Id)) return string.IsNullOrEmpty(Id) ? 0 : Id.GetHashCode();
return base.GetHashCode();
return Id.GetHashCode();
} }
internal void InsertPointCollection(List<DataPoint> list) internal void InsertPointCollection(List<DataPoint> list)

View File

@ -678,14 +678,14 @@ namespace XenAdmin.Controls.CustomGridView
public override bool Equals(object obj) public override bool Equals(object obj)
{ {
if(!(obj is GridRow)) if (!(obj is GridRow row))
return base.Equals(obj); return false;
return OpaqueRef == ((GridRow)obj).OpaqueRef; return OpaqueRef == row.OpaqueRef;
} }
public override int GetHashCode() public override int GetHashCode()
{ {
return base.GetHashCode(); return (OpaqueRef != null ? OpaqueRef.GetHashCode() : 0);
} }
} }

View File

@ -128,7 +128,7 @@ namespace XenAdmin.Controls.DataGridViewEx
public override int GetHashCode() public override int GetHashCode()
{ {
return base.GetHashCode(); return _nameCell.GetHashCode();
} }
public CheckState Checked public CheckState Checked

View File

@ -1121,7 +1121,7 @@ namespace XenAdmin.Controls.XenSearch
public override int GetHashCode() public override int GetHashCode()
{ {
return base.GetHashCode(); return (int) type;
} }
} }
@ -1327,7 +1327,7 @@ namespace XenAdmin.Controls.XenSearch
public override int GetHashCode() public override int GetHashCode()
{ {
return base.GetHashCode(); return (int) type;
} }
} }