using System;
using System.Runtime.Serialization;
namespace ParionsCuite.Modeles
{
///
/// Represents an item of a different type.
///
[DataContract]
public class Autre
{
///
/// Gets or sets the name of the item.
///
[DataMember]
public string Nom { get; set; }
///
/// Gets or sets the quantity of the item.
///
[DataMember]
public int Quantite { get; set; }
///
/// Initializes a new instance of the class with the specified name and quantity.
///
/// The name of the item.
/// The quantity of the item.
public Autre(string nom, int qu)
{
Nom = nom;
Quantite = qu;
}
///
/// Default constructor.
///
public Autre()
{
}
///
/// 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 Autre);
}
///
/// 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);
}
}
}