using System; using System.Runtime.Serialization; using System.Security.Principal; namespace ParionsCuite.Modeles { /// /// Represents a beverage item. /// [DataContract] public class Boisson { /// /// Gets or sets the name of the beverage. /// [DataMember] public string Nom { get; set; } /// /// Gets or sets the quantity of the beverage. /// [DataMember] public int Quantite { get; set; } /// /// Initializes a new instance of the class with the specified name and quantity. /// /// The name of the beverage. /// The quantity of the beverage. public Boisson(string nom, int qu) { Nom = nom; Quantite = qu; } /// /// Default constructor. /// public Boisson() { } /// /// Determines whether the specified object is equal to the current object. /// /// The object to compare with the current object. /// True if the specified object is equal to the current object; otherwise, false. public override bool Equals(object obj) { if (ReferenceEquals(obj, null)) return false; if (ReferenceEquals(obj, this)) return true; if (obj.GetType() != this.GetType()) return false; return Equals(obj as Boisson); } /// /// Returns a string that represents the current object. /// /// A string that represents the current object. public override string ToString() { return $"nom : {Nom} \n"; } /// /// Serves as a hash function for a particular type. /// /// A hash code for the current object. public override int GetHashCode() { return HashCode.Combine(Nom); } } }