mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 17:07:38 +08:00
Add nullable equality comparers
This commit is contained in:
parent
29d0d5badf
commit
00f0321f25
@ -29,12 +29,17 @@ namespace osu.Game.Online.Multiplayer
|
||||
[Key(4)]
|
||||
public QueueMode QueueMode { get; set; } = QueueMode.HostOnly;
|
||||
|
||||
public bool Equals(MultiplayerRoomSettings other)
|
||||
=> Password.Equals(other.Password, StringComparison.Ordinal)
|
||||
&& Name.Equals(other.Name, StringComparison.Ordinal)
|
||||
&& PlaylistItemId == other.PlaylistItemId
|
||||
&& MatchType == other.MatchType
|
||||
&& QueueMode == other.QueueMode;
|
||||
public bool Equals(MultiplayerRoomSettings? other)
|
||||
{
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
if (other == null) return false;
|
||||
|
||||
return Password.Equals(other.Password, StringComparison.Ordinal)
|
||||
&& Name.Equals(other.Name, StringComparison.Ordinal)
|
||||
&& PlaylistItemId == other.PlaylistItemId
|
||||
&& MatchType == other.MatchType
|
||||
&& QueueMode == other.QueueMode;
|
||||
}
|
||||
|
||||
public override string ToString() => $"Name:{Name}"
|
||||
+ $" Password:{(string.IsNullOrEmpty(Password) ? "no" : "yes")}"
|
||||
|
@ -48,9 +48,10 @@ namespace osu.Game.Online.Multiplayer
|
||||
UserID = userId;
|
||||
}
|
||||
|
||||
public bool Equals(MultiplayerRoomUser other)
|
||||
public bool Equals(MultiplayerRoomUser? other)
|
||||
{
|
||||
if (ReferenceEquals(this, other)) return true;
|
||||
if (other == null) return false;
|
||||
|
||||
return UserID == other.UserID;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user