Skip to content

Commit 077d487

Browse files
author
Vegard Stigen
committed
finished module with tests
1 parent a0739af commit 077d487

File tree

1 file changed

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

1 file changed

+5
-4
lines changed

csharp-fundamentals-lists.Main/Core.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +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-
34+
_iceCreams.Add("Phish Food");
35+
_iceCreams.Add("Peanut Butter Cup");
3536
return _iceCreams;
3637
}
3738

@@ -41,15 +42,15 @@ public int Question2()
4142
//TODO: find the lists method that returns the number of ice creams in the list and return this.
4243

4344
// remove exception and write code here
44-
throw new NotImplementedException();
45+
return _iceCreams.Count;
4546
}
4647
public List<string> Question3()
4748
{
4849

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

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

5455
return results;
5556

@@ -65,7 +66,7 @@ public List<string> Question4()
6566
// be sure to include the MoreIceCream and EvenMoreIceCream lists
6667

6768

68-
List<string> results = _iceCreams;
69+
List<string> results = _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).Distinct().ToList();
6970
// remove exception and write code here
7071
return results;
7172
}

0 commit comments

Comments
 (0)