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.

41 lines
872 B

using System;
namespace DragNDrop.Model;
public class Nounours : IEquatable<Nounours>
{
public int Id { get; private init; }
public string Name { get; private set; }
public string Image => $"{Name.ToLower().Replace(" ", "_")}.png";
public Nounours(int id, string name)
{
Id = id;
Name = name;
}
public Nounours(string name)
: this(0, name)
{}
public override string ToString()
=> $"{Name}";
public bool Equals(Nounours? other)
=> Id == other?.Id;
public override bool Equals(object? obj)
{
if(ReferenceEquals(obj, null)) return false;
if(ReferenceEquals(obj, this)) return true;
if(!GetType().Equals(obj.GetType())) return false;
return Equals(obj as Nounours);
}
public override int GetHashCode()
=> Id.GetHashCode();
}