Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed the equality contract on Metrics type #7733

Merged
merged 3 commits into from
Jul 10, 2023

Commits on May 19, 2023

  1. Optimized metrics names equality comparison

    `SetEqual` is available since .NET Fx 3.5 and is destined for equality
    comparison of two different hash set instances. Since both instances of
    the `Metrics` type has the same default comparer, the method works as
    a sugar over a length check followed by iteration over one set and
    probing the second one for containing the current element through
    the `Contains` method.
    YohDeadfall committed May 19, 2023
    Configuration menu
    Copy the full SHA
    de3a6b8 View commit details
    Browse the repository at this point in the history
  2. Fixed GetHashCode implementation on Metrics type

    `HashSet<T>` doesn't override `GetHashCode`. Therefore, the default
    provided algorithm for reference types is used which doesn't take
    fields into account as it happens for value types. That breaks the
    equality contracts on Metrics.
    
    Ideally `HashCode` type should be used for more correct computations
    with less number of collisions, but that requires increasing the
    minimal target framework.
    YohDeadfall committed May 19, 2023
    Configuration menu
    Copy the full SHA
    d91e2ec View commit details
    Browse the repository at this point in the history

Commits on May 22, 2023

  1. Configuration menu
    Copy the full SHA
    3cf87fc View commit details
    Browse the repository at this point in the history