/// <summary> /// Initializes a new instance of the <see cref="SportEventConditions"/> class /// </summary> /// <param name="ci">A <see cref="SportEventConditionsCI"/> used to create new instance</param> /// <param name="cultures">A <see cref="IEnumerable{CultureInfo}"/> specifying the supported languages of the constructed instance</param> public SportEventConditions(SportEventConditionsCI ci, IEnumerable <CultureInfo> cultures) { Guard.Argument(ci, nameof(ci)).NotNull(); Guard.Argument(cultures, nameof(cultures)).NotNull();//.NotEmpty(); if (!cultures.Any()) { throw new ArgumentOutOfRangeException(nameof(cultures)); } Attendance = ci.Attendance; EventMode = ci.EventMode; if (ci.Referee != null) { Referee = new Referee(ci.Referee, cultures); } if (ci.WeatherInfo != null) { WeatherInfo = new WeatherInfo(ci.WeatherInfo); } if (ci.Pitchers != null) { Pitchers = ci.Pitchers.Select(s => new Pitcher(s)); } }
/// <summary> /// Initializes a new instance of the <see cref="SportEventConditions" /> class /// </summary> /// <param name="ci">A <see cref="SportEventConditionsCI" /> used to create new instance</param> /// <param name="cultures">A <see cref="IEnumerable{T}" /> specifying the supported languages of the constructed instance</param> public SportEventConditions(SportEventConditionsCI ci, IEnumerable <CultureInfo> cultures) { Contract.Requires(ci != null); Contract.Requires(cultures != null && cultures.Any()); Attendance = ci.Attendance; EventMode = ci.EventMode; if (ci.Referee != null) { Referee = new Referee(ci.Referee, cultures); } if (ci.WeatherInfo != null) { WeatherInfo = new WeatherInfo(ci.WeatherInfo); } if (ci.Pitchers != null) { Pitchers = ci.Pitchers.Select(s => new Pitcher(s)); } }