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)
{
if(!(obj is DataSet))
return base.Equals(obj);
DataSet other = (DataSet)obj;
if (!(obj is DataSet other))
return false;
return Id == other.Id;
}
public override int GetHashCode()
{
if (string.IsNullOrEmpty(Id))
return base.GetHashCode();
return Id.GetHashCode();
return string.IsNullOrEmpty(Id) ? 0 : Id.GetHashCode();
}
internal void InsertPointCollection(List<DataPoint> list)

View File

@ -678,14 +678,14 @@ namespace XenAdmin.Controls.CustomGridView
public override bool Equals(object obj)
{
if(!(obj is GridRow))
return base.Equals(obj);
return OpaqueRef == ((GridRow)obj).OpaqueRef;
if (!(obj is GridRow row))
return false;
return OpaqueRef == row.OpaqueRef;
}
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()
{
return base.GetHashCode();
return _nameCell.GetHashCode();
}
public CheckState Checked

View File

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