👔 Create the Player class
continuous-integration/drone/push Build is passing Details

pull/42/head
Alexis Drai 3 years ago
parent e243144fe5
commit 9fa4fb56ea

@ -1,12 +1,38 @@
namespace Model using System;
namespace Model
{ {
public class Player public class Player : IEquatable<Player>
{ {
private readonly string _name; public string Name { get; internal set; }
public Player(string name) public Player(string name)
{ {
_name = name; Name = name;
}
public override string ToString()
{
return Name;
}
public bool Equals(Player other)
{
return Name.ToUpper() == other.Name.ToUpper();
}
public override bool Equals(Object obj)
{
if (obj is not Player)
{
return false;
}
return Equals(obj as Player);
}
public override int GetHashCode()
{
return Name.GetHashCode();
} }
public string Name => _name;
} }
} }

Loading…
Cancel
Save