Skip to content

Commit

Permalink
Update equals (#85896)
Browse files Browse the repository at this point in the history
  • Loading branch information
hrrrrustic authored May 9, 2023
1 parent d3eebef commit 5318f75
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1164,7 +1164,7 @@ public PropertyTabAttribute(System.Type tabClass, System.ComponentModel.Property
public System.Type[] TabClasses { get { throw null; } }
protected string[]? TabClassNames { get { throw null; } }
public System.ComponentModel.PropertyTabScope[] TabScopes { get { throw null; } }
public bool Equals(System.ComponentModel.PropertyTabAttribute other) { throw null; }
public bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] System.ComponentModel.PropertyTabAttribute? other) { throw null; }
public override bool Equals([System.Diagnostics.CodeAnalysis.NotNullWhenAttribute(true)] object? other) { throw null; }
public override int GetHashCode() { throw null; }
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCodeAttribute("The Types referenced by tabClassNames may be trimmed.")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,34 +145,25 @@ private void InitializeTabClasses()
public PropertyTabScope[] TabScopes { get; private set; }

public override bool Equals([NotNullWhen(true)] object? other)
{
if (other is PropertyTabAttribute propertyTabAttribute)
{
return Equals(propertyTabAttribute);
}
return false;
}
=> Equals(other as PropertyTabAttribute);

public bool Equals(PropertyTabAttribute other)
public bool Equals([NotNullWhen(true)] PropertyTabAttribute? other)
{
if (other == (object)this)
{
if (other is null)
return false;

if (ReferenceEquals(this, other))
return true;
}
if (other.TabClasses.Length != TabClasses.Length ||
other.TabScopes.Length != TabScopes.Length)
{

if (other.TabClasses.Length != TabClasses.Length || other.TabScopes.Length != TabScopes.Length)
return false;
}

for (int i = 0; i < TabClasses.Length; i++)
{
if (TabClasses[i] != other.TabClasses[i] ||
TabScopes[i] != other.TabScopes[i])
{
if (TabClasses[i] != other.TabClasses[i] || TabScopes[i] != other.TabScopes[i])
return false;
}
}

return true;
}

Expand Down

0 comments on commit 5318f75

Please sign in to comment.