From 6bcbe379531c8b09a4e440599488773f72acafd8 Mon Sep 17 00:00:00 2001 From: Mona Eikli Andresen Date: Fri, 8 Aug 2025 10:49:59 +0200 Subject: [PATCH] Mona Eikli --- csharp-fundamentals-lists.Main/Core.cs | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/csharp-fundamentals-lists.Main/Core.cs b/csharp-fundamentals-lists.Main/Core.cs index 185c6d3..8262ee4 100644 --- a/csharp-fundamentals-lists.Main/Core.cs +++ b/csharp-fundamentals-lists.Main/Core.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Security.Cryptography.X509Certificates; using System.Text; using System.Threading.Tasks; @@ -32,16 +33,17 @@ public List Question1() //write code here + _iceCreams.Add("Phish Food"); + _iceCreams.Add("Peanut Butter Cup"); + return _iceCreams; } public int Question2() { + return _iceCreams.Count; - //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(); + } public List Question3() { @@ -49,11 +51,10 @@ public List Question3() // The code below concatenates this.MoreIceCream to the _iceCreams list into a new results list. //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(); + List results = _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).ToList(); return results; - // remove exception and write code here } public List Question4() @@ -65,7 +66,7 @@ public List Question4() // be sure to include the MoreIceCream and EvenMoreIceCream lists - List results = _iceCreams; + List results = _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).Distinct().ToList(); // remove exception and write code here return results; }