Skip to content

Commit

Permalink
Finished task
Browse files Browse the repository at this point in the history
  • Loading branch information
espensl2000 committed Aug 13, 2024
1 parent f114d06 commit 83ab2ab
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions csharp-fundamentals-lists.Main/Core.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ public List<string> Question1()
// TODO: 1. Find the add method and add two more flavours of ice cream: "Phish Food", "Peanut Butter Cup"

//write code here
_iceCreams.Add("Phish Food");
_iceCreams.Add("Peanut Butter cup");

return _iceCreams;
}
Expand All @@ -41,15 +43,15 @@ public int Question2()
//TODO: find the lists method that returns the number of ice creams in the list and return this.

// remove exception and write code here
throw new NotImplementedException();
return _iceCreams.Count;
}
public List<string> Question3()
{

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

List<string> results = _iceCreams.Concat(this.MoreIceCream).ToList();
List<string> results = _iceCreams.Concat(this.MoreIceCream).Concat(EvenMoreIceCream).ToList();

return results;

Expand All @@ -65,7 +67,7 @@ public List<string> Question4()
// be sure to include the MoreIceCream and EvenMoreIceCream lists


List<string> results = _iceCreams;
List<string> results = _iceCreams.Concat(this.MoreIceCream).Distinct().ToList();
// remove exception and write code here
return results;
}
Expand Down

0 comments on commit 83ab2ab

Please sign in to comment.