using System;
using System.Runtime.Serialization;
namespace ParionsCuite.Modeles
{
[DataContract]
public class Nourriture
{
///
/// Gets or sets the name of the food.
///
[DataMember]
public string Nom { get; set; }
///
/// Gets or sets the quantity of the food.
///
[DataMember]
public int Quantite { get; set; }
///
/// Initializes a new instance of the class.
///
/// The name of the food.
/// The quantity of the food.
public Nourriture(string nom, int qu)
{
Nom = nom;
Quantite = qu;
}
///
/// Initializes a new instance of the class.
///
public Nourriture()
{
}
///
/// Determines whether the current object is equal to another object.
///
/// The object to compare with the current object.
/// true if the objects are equal; 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 Nourriture);
}
///
/// Returns a string that represents the current object.
///
/// A string representation of the object.
public override string ToString()
{
return $"nom : {Nom} \n";
}
///
/// Serves as a hash function for a object.
///
/// A hash code for the current object.
public override int GetHashCode()
{
return HashCode.Combine(Nom);
}
}
}