Implement IEquatable<Country>

This commit is contained in:
Andrei Zavatski 2019-12-01 03:52:41 +03:00
parent c451542915
commit 0ac4675546
2 changed files with 4 additions and 4 deletions

View File

@ -111,9 +111,6 @@ public void ShowCountry(Country requested)
Show(); Show();
if (country.Value?.FlagName == requested.FlagName)
return;
country.Value = requested; country.Value = requested;
} }

View File

@ -1,11 +1,12 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System;
using Newtonsoft.Json; using Newtonsoft.Json;
namespace osu.Game.Users namespace osu.Game.Users
{ {
public class Country public class Country : IEquatable<Country>
{ {
/// <summary> /// <summary>
/// The name of this country. /// The name of this country.
@ -18,5 +19,7 @@ public class Country
/// </summary> /// </summary>
[JsonProperty(@"code")] [JsonProperty(@"code")]
public string FlagName; public string FlagName;
public bool Equals(Country other) => FlagName == other.FlagName;
} }
} }