diff --git a/MCTG/MCTGApp/Program.cs b/MCTG/MCTGApp/Program.cs index 57a3a18..9998a9b 100644 --- a/MCTG/MCTGApp/Program.cs +++ b/MCTG/MCTGApp/Program.cs @@ -29,7 +29,7 @@ Console.WriteLine("test overload of [] operator:"); try { rc[2].DisplayId(); - rc.GetById(14).DisplayId(); + rc.GetById(110).DisplayId(); } catch (ArgumentNullException) { @@ -51,5 +51,5 @@ RecipeCollection rc2 = new RecipeCollection( Console.WriteLine("test of Enumerable property:"); foreach (Recipe r in rc2) { - r.DisplayId(); Console.Write(" - "); + r.DisplayId(); } diff --git a/MCTG/MCTGLib/RecipeCollection.cs b/MCTG/MCTGLib/RecipeCollection.cs index c9ed6be..0611a0f 100644 --- a/MCTG/MCTGLib/RecipeCollection.cs +++ b/MCTG/MCTGLib/RecipeCollection.cs @@ -39,7 +39,7 @@ namespace Model public RecipeCollection(params Recipe[] recipes) : base(ComputeId()) { - _recipes.CopyTo(recipes, 0); + _recipes = new List(recipes); } #endregion @@ -116,7 +116,7 @@ namespace Model IEnumerator IEnumerable.GetEnumerator() { - return _recipes.GetEnumerator(); + return this.GetEnumerator(); } #endregion