[ADD] added equals operators

This commit is contained in:
Sem van der Hoeven
2020-10-21 22:03:20 +02:00
parent cc5c71a30f
commit 9e1ac07b80

View File

@@ -27,6 +27,30 @@ namespace SharedClientServer
_host = false;
}
public static bool operator ==(User u1, User u2)
{
return u1.Username == u2.Username;
}
public static bool operator !=(User u1, User u2)
{
return u1.Username != u2.Username;
}
public override bool Equals(object obj)
{
if ((obj == null) || !this.GetType().Equals(obj.GetType()))
{
return false;
}
else
{
User other = obj as User;
return other.Username == this.Username;
}
}
public string Username
{
get { return _username; }