You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
815 B
31 lines
815 B
using System.Runtime.Serialization;
|
|
|
|
namespace CoreLibrary.Core
|
|
{
|
|
[DataContract]
|
|
public readonly struct Jeton
|
|
{
|
|
[DataMember]
|
|
public Couleur Couleur { get; private init; }
|
|
|
|
public Jeton(Couleur couleur)
|
|
{
|
|
Couleur = couleur;
|
|
}
|
|
|
|
public override readonly bool Equals(object? objet)
|
|
{
|
|
if (objet == null || objet is not Jeton)
|
|
return false;
|
|
|
|
return Couleur == ((Jeton)objet).Couleur;
|
|
}
|
|
|
|
public static bool operator ==(Jeton gauche, Jeton droite) => gauche.Equals(droite);
|
|
|
|
public static bool operator !=(Jeton gauche, Jeton droite) => gauche.Equals(droite);
|
|
|
|
public override readonly int GetHashCode() => Couleur.GetHashCode();
|
|
}
|
|
}
|