Skip to content

Commit 91507cb

Browse files
all tests passed
1 parent a0739af commit 91507cb

File tree

1 file changed

+7
-3
lines changed
  • csharp-fundamentals-lists.Main

1 file changed

+7
-3
lines changed

csharp-fundamentals-lists.Main/Core.cs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ public List<string> Question1()
3131
// TODO: 1. Find the add method and add two more flavours of ice cream: "Phish Food", "Peanut Butter Cup"
3232

3333
//write code here
34+
_iceCreams.Add("Phish Food");
35+
_iceCreams.Add("Peanut Butter Cup");
3436

3537
return _iceCreams;
3638
}
@@ -41,16 +43,16 @@ public int Question2()
4143
//TODO: find the lists method that returns the number of ice creams in the list and return this.
4244

4345
// remove exception and write code here
44-
throw new NotImplementedException();
46+
return _iceCreams.Count;
4547
}
4648
public List<string> Question3()
4749
{
4850

4951
// The code below concatenates this.MoreIceCream to the _iceCreams list into a new results list.
5052
//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()
5153

52-
List<string> results = _iceCreams.Concat(this.MoreIceCream).ToList();
53-
54+
List<string> results = _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).ToList();
55+
5456
return results;
5557

5658
// remove exception and write code here
@@ -67,6 +69,8 @@ public List<string> Question4()
6769

6870
List<string> results = _iceCreams;
6971
// remove exception and write code here
72+
results = results.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).Distinct().ToList();
73+
7074
return results;
7175
}
7276

0 commit comments

Comments
 (0)