Skip to content

Commit c1ec0de

Browse files
author
Miadog7Extra
committed
core completed
1 parent a0739af commit c1ec0de

File tree

1 file changed

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

1 file changed

+13
-8
lines changed

csharp-fundamentals-lists.Main/Core.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,30 +30,33 @@ public List<string> Question1()
3030
// by typing _iceCreams. intellisense shows all of the methods associated with the _inceCreams list.
3131
// TODO: 1. Find the add method and add two more flavours of ice cream: "Phish Food", "Peanut Butter Cup"
3232

33-
//write code here
33+
_iceCreams.Add("Phish Food");
34+
_iceCreams.Add("Peanut Butter Cup");
3435

3536
return _iceCreams;
3637
}
3738

3839
public int Question2()
3940
{
40-
41+
4142
//TODO: find the lists method that returns the number of ice creams in the list and return this.
4243

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();
53-
54-
return results;
52+
//List<string> results = _iceCreams.Concat(this.MoreIceCream).ToList();
53+
54+
//return results;
5555

5656
// remove exception and write code here
57+
List<string> results = _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).ToList();
58+
59+
return results;
5760

5861
}
5962
public List<string> Question4()
@@ -65,7 +68,9 @@ public List<string> Question4()
6568
// be sure to include the MoreIceCream and EvenMoreIceCream lists
6669

6770

68-
List<string> results = _iceCreams;
71+
List<string> results = _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).Distinct().ToList();
72+
results = _iceCreams.Concat(this.EvenMoreIceCream).Concat(this.EvenMoreIceCream).Distinct().ToList();
73+
6974
// remove exception and write code here
7075
return results;
7176
}

0 commit comments

Comments
 (0)