/// <summary> /// Asynchronous export item's properties /// </summary> /// <returns>An <see cref="ExportableCI"/> instance containing all relevant properties</returns> public async Task <ExportableSportEventConditionsCI> ExportAsync() { var pitcherTasks = Pitchers?.Select(async p => await p.ExportAsync().ConfigureAwait(false)); return(new ExportableSportEventConditionsCI { Attendance = Attendance, EventMode = EventMode, Referee = Referee != null ? await Referee.ExportAsync().ConfigureAwait(false) : null, WeatherInfo = WeatherInfo != null ? await WeatherInfo.ExportAsync().ConfigureAwait(false) : null, Pitchers = pitcherTasks != null ? await Task.WhenAll(pitcherTasks) : null }); }
/// <summary> /// Asynchronous export item's properties /// </summary> /// <returns>An <see cref="ExportableCI"/> instance containing all relevant properties</returns> public async Task <ExportableSportEventConditionsCI> ExportAsync() { var pitcherTasks = Pitchers?.Select(async p => await p.ExportAsync().ConfigureAwait(false)).ToList(); if (!pitcherTasks.IsNullOrEmpty()) { await Task.WhenAll(pitcherTasks).ConfigureAwait(false); } return(new ExportableSportEventConditionsCI { Attendance = Attendance, EventMode = EventMode, Referee = Referee != null ? await Referee.ExportAsync().ConfigureAwait(false) : null, WeatherInfo = WeatherInfo != null ? await WeatherInfo.ExportAsync().ConfigureAwait(false) : null, Pitchers = pitcherTasks.IsNullOrEmpty() ? null : pitcherTasks.Select(s => s.Result).ToList() }); }