示例#1
0
        public void DeletePlayer()
        {
            if (Players.Count <= 0)
            {
                Console.WriteLine("Druzyna nie ma zawodnikow");
            }
            else
            {
                StreamReader streamReader = new StreamReader("Players.txt");

                string imie;
                string nazwisko;
                imie     = Console.ReadLine();
                nazwisko = Console.ReadLine();
                VolleyballPlayer newPlayer = new VolleyballPlayer(imie, nazwisko);

                foreach (VolleyballPlayer player in Players)
                {
                    if (player == newPlayer)
                    {
                        Players.Remove(player);
                    }
                }
            }
        }
示例#2
0
        public void AddPlayer()
        {
            StreamWriter streamWriter = new StreamWriter("Players.txt", true);



            if (Players.Count >= 5)
            {
                Console.WriteLine("Druzyna ma zbyt wielu zawodnikow");
            }
            else
            {
                string imie;
                string nazwisko;
                imie     = Console.ReadLine();
                nazwisko = Console.ReadLine();
                VolleyballPlayer player = new VolleyballPlayer(imie, nazwisko);
                Players.Add(player);
            }
            foreach (VolleyballPlayer player in Players)
            {
                streamWriter.WriteLine(player);
            }
        }