Skip to content

Commit 2a4dbd8

Browse files
committed
Fixed ambiguous equals in Display
1 parent 2614596 commit 2a4dbd8

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

ScreenCapture.NET/Model/Display.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// ReSharper disable MemberCanBePrivate.Global
22

3+
using System;
4+
35
namespace ScreenCapture.NET;
46

57
/// <summary>
@@ -58,20 +60,20 @@ public Display(int index, string deviceName, int width, int height, GraphicsCard
5860
#endregion
5961

6062
#region Methods
61-
63+
6264
/// <summary>
6365
/// Determines whether this <see cref="Display"/> equals the given one.
6466
/// </summary>
6567
/// <param name="other">The <see cref="Display"/> to compare.</param>
6668
/// <returns><c>true</c> if the specified object is equal to the current object; otherwise, <c>false</c>.</returns>
67-
public bool Equals(Display other) => Index == other.Index;
69+
public bool Equals(Display other) => (Index == other.Index) && GraphicsCard.Equals(other.GraphicsCard);
6870

6971
/// <inheritdoc />
7072
public override bool Equals(object? obj) => obj is Display other && Equals(other);
7173

7274
/// <inheritdoc />
73-
public override int GetHashCode() => Index;
74-
75+
public override int GetHashCode() => HashCode.Combine(Index, GraphicsCard);
76+
7577
/// <summary>
7678
/// Determines whether two <see cref="Display"/> are equal.
7779
/// </summary>

ScreenCapture.NET/ScreenCapture.NET.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
2727

2828
<PackageReleaseNotes>
29-
- Added IScreenCapture.UpdateCaptureZone to modify existing CaptureZones without having to remove and add them again.
29+
- Added IScreenCapture.UpdateCaptureZone to modify existing CaptureZones without having to remove and add them again.
3030
(This has performance benefits when only X and/or Y is changed, changes to width, height and downscale are internally still reinitializing the zone.)
31+
- Fixed ambiguous equals in Display
3132
</PackageReleaseNotes>
3233

3334
<Version>1.2.0</Version>

0 commit comments

Comments
 (0)