Skip to content

Commit c69697b

Browse files
author
Jonatan Berg Romundgard
committed
yessir
1 parent a0739af commit c69697b

File tree

1 file changed

+6
-3
lines changed
  • csharp-fundamentals-lists.Main

1 file changed

+6
-3
lines changed

csharp-fundamentals-lists.Main/Core.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,19 @@ 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-
42+
4143
//TODO: find the lists method that returns the number of ice creams in the list and return this.
4244

4345
// remove exception and write code here
46+
return _iceCreams.Count;
4447
throw new NotImplementedException();
4548
}
4649
public List<string> Question3()
@@ -49,7 +52,7 @@ public List<string> Question3()
4952
// The code below concatenates this.MoreIceCream to the _iceCreams list into a new results list.
5053
//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()
5154

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

5457
return results;
5558

@@ -65,7 +68,7 @@ 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();
6972
// remove exception and write code here
7073
return results;
7174
}

0 commit comments

Comments
 (0)