Skip to content

Commit aa62466

Browse files
committed
Finished
1 parent a0739af commit aa62466

File tree

2 files changed

+8
-13
lines changed

2 files changed

+8
-13
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
# User-specific files (MonoDevelop/Xamarin Studio)
1414
*.userprefs
1515

16+
# Jetbrains Project Files
17+
.idea/
18+
1619
# Mono auto generated files
1720
mono_crash.*
1821

csharp-fundamentals-lists.Main/Core.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,24 @@ 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
}
3739

3840
public int Question2()
3941
{
40-
4142
//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();
43+
return _iceCreams.Count;
4544
}
4645
public List<string> Question3()
4746
{
4847

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

52-
List<string> results = _iceCreams.Concat(this.MoreIceCream).ToList();
53-
54-
return results;
55-
56-
// remove exception and write code here
57-
51+
return _iceCreams.Concat(MoreIceCream).Concat(EvenMoreIceCream).ToList();
5852
}
5953
public List<string> Question4()
6054
{
@@ -65,9 +59,7 @@ public List<string> Question4()
6559
// be sure to include the MoreIceCream and EvenMoreIceCream lists
6660

6761

68-
List<string> results = _iceCreams;
69-
// remove exception and write code here
70-
return results;
62+
return _iceCreams.Concat(MoreIceCream).Concat(EvenMoreIceCream).Distinct().ToList();
7163
}
7264

7365
public List<string> MoreIceCream = new List<string>()

0 commit comments

Comments
 (0)