You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: csharp-fundamentals-lists.Main/Core.cs
+17-12Lines changed: 17 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ public class Core
19
19
20
20
publicCore()
21
21
{
22
-
22
+
23
23
}
24
24
25
25
publicList<string>Question1()
@@ -31,26 +31,31 @@ public List<string> Question1()
31
31
// TODO: 1. Find the add method and add two more flavours of ice cream: "Phish Food", "Peanut Butter Cup"
32
32
33
33
//write code here
34
+
_iceCreams.Add("Phish Food");
35
+
_iceCreams.Add("Peanut Butter Cup");
36
+
37
+
34
38
35
-
return_iceCreams;
39
+
return_iceCreams;
36
40
}
37
41
38
42
publicintQuestion2()
39
43
{
40
-
44
+
41
45
//TODO: find the lists method that returns the number of ice creams in the list and return this.
42
46
43
-
// remove exception and write code here
44
-
thrownewNotImplementedException();
47
+
return_iceCreams.Count;
45
48
}
46
49
publicList<string>Question3()
47
50
{
48
51
49
52
// The code below concatenates this.MoreIceCream to the _iceCreams list into a new results list.
50
-
//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()
53
+
// TODO: you can 'chain' methods on the _iceCream list, so add another Concat to
54
+
// include EvenMoreIceCream (this is defined below) to the result list . e.g.
55
+
// _iceCreams.Concat(this.MoreIceCream).Concat(other list to concat).ToList()
@@ -59,14 +64,14 @@ public List<string> Question3()
59
64
publicList<string>Question4()
60
65
{
61
66
62
-
63
67
//TODO: Remove the duplicates using the .Distinct() placing just before the .ToList()
64
-
// copy the List declaration line from Question3 and add the .Distinct() into the chain. e.g. _iceCreams.Concat(this.MoreIceCream).Concat(other list to concat).Distinct().ToList()
68
+
// copy the List declaration line from Question3 and add the .Distinct() into the chain.
69
+
// e.g. _iceCreams.Concat(this.MoreIceCream).Concat(other list to concat).Distinct().ToList()
65
70
// be sure to include the MoreIceCream and EvenMoreIceCream lists
0 commit comments