Пример #1
0
        public Contestant PickWinner()
        {
            Contestant contestWinner = new Contestant();

            contestRegNumber = rng.Next(1, 1000);
            //if (contestRegNumber == contestants[contestRegNumber])//try to just reference the key
            //{
            //    return contestWinner;//should be new contestant in the dictionary being returned
            //}
            //else
            //{
            //    PickWinner();
            //}
            foreach (KeyValuePair <int, Contestant> contestant in contestants)
            {
                if (contestRegNumber == contestant.Key)
                {
                    contestWinner = contestant.Value;
                }
            }
            return(contestWinner);
        }
Пример #2
0
 public void PrintContestantInfo(Contestant contestant)
 {
     Console.WriteLine(contestant);
 }