public void RemoveServer(Server s) { // filter out the server from our list of servers var filtered = ServerModel.Servers.Where(x => x.EndPoint != s.EndPoint); // write addresses to file var addresses = filtered.Select(x => x.EndPoint.ToString()).ToArray(); File.WriteAllLines(savefile, addresses); ServerModel.RemoveServer(s.EndPoint.ToString()); }