Fixed ambiguous equals in Display

This commit is contained in:
Darth Affe 2022-05-02 22:21:10 +02:00
parent 2614596807
commit 2a4dbd8fe5
2 changed files with 8 additions and 5 deletions

View File

@ -1,5 +1,7 @@
// ReSharper disable MemberCanBePrivate.Global // ReSharper disable MemberCanBePrivate.Global
using System;
namespace ScreenCapture.NET; namespace ScreenCapture.NET;
/// <summary> /// <summary>
@ -58,20 +60,20 @@ public readonly struct Display
#endregion #endregion
#region Methods #region Methods
/// <summary> /// <summary>
/// Determines whether this <see cref="Display"/> equals the given one. /// Determines whether this <see cref="Display"/> equals the given one.
/// </summary> /// </summary>
/// <param name="other">The <see cref="Display"/> to compare.</param> /// <param name="other">The <see cref="Display"/> to compare.</param>
/// <returns><c>true</c> if the specified object is equal to the current object; otherwise, <c>false</c>.</returns> /// <returns><c>true</c> if the specified object is equal to the current object; otherwise, <c>false</c>.</returns>
public bool Equals(Display other) => Index == other.Index; public bool Equals(Display other) => (Index == other.Index) && GraphicsCard.Equals(other.GraphicsCard);
/// <inheritdoc /> /// <inheritdoc />
public override bool Equals(object? obj) => obj is Display other && Equals(other); public override bool Equals(object? obj) => obj is Display other && Equals(other);
/// <inheritdoc /> /// <inheritdoc />
public override int GetHashCode() => Index; public override int GetHashCode() => HashCode.Combine(Index, GraphicsCard);
/// <summary> /// <summary>
/// Determines whether two <see cref="Display"/> are equal. /// Determines whether two <see cref="Display"/> are equal.
/// </summary> /// </summary>

View File

@ -26,8 +26,9 @@
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<PackageReleaseNotes> <PackageReleaseNotes>
- Added IScreenCapture.UpdateCaptureZone to modify existing CaptureZones without having to remove and add them again. - Added IScreenCapture.UpdateCaptureZone to modify existing CaptureZones without having to remove and add them again.
(This has performance benefits when only X and/or Y is changed, changes to width, height and downscale are internally still reinitializing the zone.) (This has performance benefits when only X and/or Y is changed, changes to width, height and downscale are internally still reinitializing the zone.)
- Fixed ambiguous equals in Display
</PackageReleaseNotes> </PackageReleaseNotes>
<Version>1.2.0</Version> <Version>1.2.0</Version>