Skip to content

Commit b43e995

Browse files
committed
Done
1 parent a0739af commit b43e995

File tree

1 file changed

+5
-8
lines changed
  • csharp-fundamentals-lists.Main

1 file changed

+5
-8
lines changed

csharp-fundamentals-lists.Main/Core.cs

Lines changed: 5 additions & 8 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
}
@@ -39,22 +41,17 @@ public int Question2()
3941
{
4042

4143
//TODO: find the lists method that returns the number of ice creams in the list and return this.
42-
43-
// remove exception and write code here
44-
throw new NotImplementedException();
44+
return _iceCreams.Count;
4545
}
4646
public List<string> Question3()
4747
{
4848

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

52-
List<string> results = _iceCreams.Concat(this.MoreIceCream).ToList();
52+
List<string> results = _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).ToList();
5353

5454
return results;
55-
56-
// remove exception and write code here
57-
5855
}
5956
public List<string> Question4()
6057
{
@@ -65,7 +62,7 @@ public List<string> Question4()
6562
// be sure to include the MoreIceCream and EvenMoreIceCream lists
6663

6764

68-
List<string> results = _iceCreams;
65+
List<string> results = _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).Distinct().ToList();
6966
// remove exception and write code here
7067
return results;
7168
}

0 commit comments

Comments
 (0)