namespace Team.Communicate.Data { public class TcpConnection { public string Ip { get; } public bool Connected { get; internal set; } public int Port { get; } public TcpConnection(string ip,int port) { Ip = ip; Port = port; } public override bool Equals(object obj) { if (obj is TcpConnection serverConnection) { return Equals(serverConnection); } return false; } protected bool Equals(TcpConnection other) { return Ip == other.Ip && Port == other.Port; } public override int GetHashCode() { unchecked { var hashCode = Ip != null ? Ip.GetHashCode() : 0; hashCode = (hashCode * 397) ^ Port; return hashCode; } } } }