diff --git a/src/Avalonia.Controls/Platform/IScreenImpl.cs b/src/Avalonia.Controls/Platform/IScreenImpl.cs
index e6ac360861..5574c8170b 100644
--- a/src/Avalonia.Controls/Platform/IScreenImpl.cs
+++ b/src/Avalonia.Controls/Platform/IScreenImpl.cs
@@ -27,7 +27,8 @@ namespace Avalonia.Platform
public override IPlatformHandle? TryGetPlatformHandle() => platformHandle;
public override int GetHashCode() => platformHandle.GetHashCode();
- public override bool Equals(object? obj)
+
+ public override bool Equals(Screen? obj)
{
return obj is PlatformScreen other && platformHandle.Equals(other.TryGetPlatformHandle()!);
}
diff --git a/src/Avalonia.Controls/Platform/Screen.cs b/src/Avalonia.Controls/Platform/Screen.cs
index 8d3fe1679d..4622fee005 100644
--- a/src/Avalonia.Controls/Platform/Screen.cs
+++ b/src/Avalonia.Controls/Platform/Screen.cs
@@ -1,5 +1,6 @@
using System;
using System.ComponentModel;
+using System.Runtime.CompilerServices;
using Avalonia.Diagnostics;
using Avalonia.Metadata;
using Avalonia.Utilities;
@@ -122,13 +123,19 @@ namespace Avalonia.Platform
///
public virtual IPlatformHandle? TryGetPlatformHandle() => null;
+ // TODO12: make abstract
+ ///
+ public override int GetHashCode()
+ => RuntimeHelpers.GetHashCode(this);
+
+ ///
+ public override bool Equals(object? obj)
+ => obj is Screen other && Equals(other);
+
+ // TODO12: make abstract
///
- public bool Equals(Screen? other)
- {
- if (other is null) return false;
- if (ReferenceEquals(this, other)) return true;
- return base.Equals(other);
- }
+ public virtual bool Equals(Screen? other)
+ => ReferenceEquals(this, other);
public static bool operator ==(Screen? left, Screen? right)
{