internal VariantDescription(VariantDescriptionCacheItem cacheItem, IEnumerable <CultureInfo> cultures) { Contract.Requires(cacheItem != null); Contract.Requires(cultures != null && cultures.Any()); var cultureList = cultures as IList <CultureInfo> ?? cultures.ToList(); Id = cacheItem.Id; Outcomes = cacheItem.Outcomes == null ? null : new ReadOnlyCollection <IOutcomeDescription>(cacheItem.Outcomes.Select(o => (IOutcomeDescription) new OutcomeDescription(o, cultureList)).ToList()); Mappings = cacheItem.Mappings == null ? null : new ReadOnlyCollection <IMarketMappingData>(cacheItem.Mappings.Select(m => (IMarketMappingData) new MarketMapping(m)).ToList()); VariantDescriptionCacheItem = cacheItem; }
internal VariantDescription(VariantDescriptionCacheItem cacheItem, IEnumerable <CultureInfo> cultures) { Guard.Argument(cacheItem, nameof(cacheItem)).NotNull(); Guard.Argument(cultures, nameof(cultures)).NotNull().NotEmpty(); var cultureList = cultures as IList <CultureInfo> ?? cultures.ToList(); Id = cacheItem.Id; Outcomes = cacheItem.Outcomes == null ? null : new ReadOnlyCollection <IOutcomeDescription>(cacheItem.Outcomes.Select(o => (IOutcomeDescription) new OutcomeDescription(o, cultureList)).ToList()); Mappings = cacheItem.Mappings == null ? null : new ReadOnlyCollection <IMarketMappingData>(cacheItem.Mappings.Select(m => (IMarketMappingData) new MarketMapping(m)).ToList()); VariantDescriptionCacheItem = cacheItem; }