Skip to content

Commit ff78202

Browse files
committed
done
1 parent a0739af commit ff78202

File tree

1 file changed

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

1 file changed

+12
-6
lines changed

csharp-fundamentals-lists.Main/Core.cs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public class Core
1919

2020
public Core()
2121
{
22-
22+
2323
}
2424

2525
public List<string> Question1()
@@ -32,16 +32,20 @@ public List<string> Question1()
3232

3333
//write code here
3434

35-
return _iceCreams;
35+
_iceCreams.Add("Phish Food");
36+
_iceCreams.Add("Peanut Butter Cup");
37+
38+
39+
return _iceCreams;
3640
}
3741

3842
public int Question2()
3943
{
40-
44+
4145
//TODO: find the lists method that returns the number of ice creams in the list and return this.
4246

4347
// remove exception and write code here
44-
throw new NotImplementedException();
48+
return _iceCreams.Count;
4549
}
4650
public List<string> Question3()
4751
{
@@ -50,8 +54,8 @@ public List<string> Question3()
5054
//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()
5155

5256
List<string> results = _iceCreams.Concat(this.MoreIceCream).ToList();
53-
54-
return results;
57+
58+
return results.Concat(this.EvenMoreIceCream).ToList();
5559

5660
// remove exception and write code here
5761

@@ -67,6 +71,8 @@ public List<string> Question4()
6771

6872
List<string> results = _iceCreams;
6973
// remove exception and write code here
74+
results = _iceCreams.Concat(this.MoreIceCream).Concat(this.EvenMoreIceCream).Distinct().ToList();
75+
7076
return results;
7177
}
7278

0 commit comments

Comments
 (0)