Skip to content

Commit bf3a459

Browse files
author
Roman Eriksen
committed
Tests passed
1 parent a0739af commit bf3a459

File tree

1 file changed

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

1 file changed

+10
-4
lines changed

csharp-fundamentals-lists.Main/Core.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Security.Cryptography.X509Certificates;
45
using System.Text;
56
using System.Threading.Tasks;
67

@@ -31,25 +32,29 @@ public List<string> Question1()
3132
// TODO: 1. Find the add method and add two more flavours of ice cream: "Phish Food", "Peanut Butter Cup"
3233

3334
//write code here
35+
_iceCreams.Add("Phish Food");
36+
_iceCreams.Add("Peanut Butter Cup");
3437

3538
return _iceCreams;
3639
}
3740

3841
public int Question2()
3942
{
40-
43+
4144
//TODO: find the lists method that returns the number of ice creams in the list and return this.
4245

4346
// remove exception and write code here
44-
throw new NotImplementedException();
47+
// throw new NotImplementedException();
48+
49+
return _iceCreams.Count;
4550
}
4651
public List<string> Question3()
4752
{
4853

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

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

5459
return results;
5560

@@ -65,7 +70,8 @@ public List<string> Question4()
6570
// be sure to include the MoreIceCream and EvenMoreIceCream lists
6671

6772

68-
List<string> results = _iceCreams;
73+
// List<string> results = _iceCreams;
74+
List<string> results = _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).Distinct().ToList();
6975
// remove exception and write code here
7076
return results;
7177
}

0 commit comments

Comments
 (0)