using System.Linq; using System.Collections.Generic; using csharp.StrategyPatternExample; namespace csharp.StrategyPatternExample { /// /// GildedRose class refactored to adapt the strategy pattern without making a great refactor of main method of Program.cs. /// public class GildedRoseStrategyPatternExample : IGildedRoseApp { #region Variables private IList Items; #endregion #region Constructor public GildedRoseStrategyPatternExample(IList Items) { this.Items = Items.Select(i => new ItemWrapperContext(i)).ToList(); } #endregion #region Methods public void UpdateQuality() { for (var i = 0; i < Items.Count; i++) { Items[i].UpdateQuality(); } } #endregion } }