Enable CA1067: Override Object.Equals(object) when implementing IEquatable<T> (#13871)

* Enable CA1067: Override Object.Equals(object) when implementing IEquatable<T>

* Group Equals methods

* Reformat xml documentation

* Update src/System.Management.Automation/engine/EventManager.cs

Co-authored-by: Joel Sallow (/u/ta11ow) <32407840+vexx32@users.noreply.github.com>

Co-authored-by: Joel Sallow (/u/ta11ow) <32407840+vexx32@users.noreply.github.com>
This commit is contained in:
xtqqczze 2021-08-06 00:32:33 +01:00 committed by GitHub
parent 44595a40ec
commit 01a4714b76
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 2 deletions

View file

@ -198,8 +198,8 @@ dotnet_diagnostic.CA1065.severity = warning
dotnet_diagnostic.CA1066.severity = none
# CA1067: Override Object.Equals(object) when implementing IEquatable<T>
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1067
dotnet_diagnostic.CA1067.severity = suggestion
# # https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1067
dotnet_diagnostic.CA1067.severity = warning
# CA1068: CancellationToken parameters must come last
# https://docs.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1068

View file

@ -2042,6 +2042,19 @@ namespace System.Management.Automation
#region IComparable<PSEventSubscriber> Members
/// <summary>
/// Determines whether the specified object is equal to the current object.
/// </summary>
/// <param name="obj">The object to compare with the current object.</param>
/// <returns>
/// <see langword="true"/> if the specified object is equal to the current object;
/// otherwise, <see langword="false"/>.
/// </returns>
public override bool Equals(object obj)
{
return obj is PSEventSubscriber es && Equals(es);
}
/// <summary>
/// Determines if two PSEventSubscriber instances are equal
/// <param name="other">