1
0
mirror of https://github.com/bitwarden/server.git synced 2025-06-30 07:36:14 -05:00

Prefer record to implementing IEquatable (#5449)

This commit is contained in:
Matt Gibson
2025-02-26 14:41:24 -08:00
committed by GitHub
parent 4a4d256fd9
commit bd66f06bd9
2 changed files with 3 additions and 22 deletions

View File

@ -1,23 +1,13 @@
namespace Bit.Core.NotificationHub;
public struct WebPushRegistrationData : IEquatable<WebPushRegistrationData>
public record struct WebPushRegistrationData
{
public string Endpoint { get; init; }
public string P256dh { get; init; }
public string Auth { get; init; }
public bool Equals(WebPushRegistrationData other)
{
return Endpoint == other.Endpoint && P256dh == other.P256dh && Auth == other.Auth;
}
public override int GetHashCode()
{
return HashCode.Combine(Endpoint, P256dh, Auth);
}
}
public class PushRegistrationData : IEquatable<PushRegistrationData>
public record class PushRegistrationData
{
public string Token { get; set; }
public WebPushRegistrationData? WebPush { get; set; }
@ -38,13 +28,4 @@ public class PushRegistrationData : IEquatable<PushRegistrationData>
{
WebPush = webPush;
}
public bool Equals(PushRegistrationData other)
{
return Token == other.Token && WebPush.Equals(other.WebPush);
}
public override int GetHashCode()
{
return HashCode.Combine(Token, WebPush.GetHashCode());
}
}