Пример #1
0
        // factory method example. this one could have been normal constructor
        public static Match Create(DateTime date, Country team1Country, Country team2Country)
        {
            if (team1Country == null) throw new ArgumentNullException("team1Country");
            if (team2Country == null) throw new ArgumentNullException("team2Country");
            if (team1Country.Equals(team2Country)) throw new ArgumentException("Teams must not be the same country!");

            var match = new Match { date = date };
            match.teams.Add(new Team(match, team1Country));
            match.teams.Add(new Team(match, team2Country));
            return match;
        }
Пример #2
0
 internal Team(Match match, Country country)
 {
     this.match = match;
     this.country = country;
 }
Пример #3
0
 internal Team(Match match, Country country)
 {
     Match = match;
     Country = country;
 }