From ff7820287639e989dd3b0ee8fb19a97217c35302 Mon Sep 17 00:00:00 2001 From: Ateeb Date: Wed, 8 Jan 2025 11:22:01 +0100 Subject: [PATCH] done --- csharp-fundamentals-lists.Main/Core.cs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/csharp-fundamentals-lists.Main/Core.cs b/csharp-fundamentals-lists.Main/Core.cs index 185c6d3..8dcf56c 100644 --- a/csharp-fundamentals-lists.Main/Core.cs +++ b/csharp-fundamentals-lists.Main/Core.cs @@ -19,7 +19,7 @@ public class Core public Core() { - + } public List Question1() @@ -32,16 +32,20 @@ public List Question1() //write code here - return _iceCreams; + _iceCreams.Add("Phish Food"); + _iceCreams.Add("Peanut Butter Cup"); + + + return _iceCreams; } public int Question2() { - + //TODO: find the lists method that returns the number of ice creams in the list and return this. // remove exception and write code here - throw new NotImplementedException(); + return _iceCreams.Count; } public List Question3() { @@ -50,8 +54,8 @@ public List Question3() //TODO: you can 'chain' methods on the _iceCream list, so add another Concat to include EvenMoreIceCream (this is defined below) to the result list . e.g. _iceCreams.Concat(this.MoreIceCream).Concat(other list to concat).ToList() List results = _iceCreams.Concat(this.MoreIceCream).ToList(); - - return results; + + return results.Concat(this.EvenMoreIceCream).ToList(); // remove exception and write code here @@ -67,6 +71,8 @@ public List Question4() List results = _iceCreams; // remove exception and write code here + results = _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).Distinct().ToList(); + return results; }