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:
@ -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());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user